From e6fcea8459cad2e3b89fec590b37dcc4daaf687c Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 21 Jun 2016 10:49:48 -0300 Subject: [PATCH] PLT-3261 Fix Can't create a team with GitLab if the email domain is restricted (#3379) --- api/team.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/team.go b/api/team.go index 46bff617b9..0f7298b57f 100644 --- a/api/team.go +++ b/api/team.go @@ -300,6 +300,13 @@ func isTeamCreationAllowed(c *Context, email string) bool { return false } + if result := <-Srv.Store.User().GetByEmail(email); result.Err == nil { + user := result.Data.(*model.User) + if len(user.AuthService) > 0 && len(*user.AuthData) > 0 { + return true + } + } + // commas and @ signs are optional // can be in the form of "@corp.mattermost.com, mattermost.com mattermost.org" -> corp.mattermost.com mattermost.com mattermost.org domains := strings.Fields(strings.TrimSpace(strings.ToLower(strings.Replace(strings.Replace(utils.Cfg.TeamSettings.RestrictCreationToDomains, "@", " ", -1), ",", " ", -1))))