[MM-22791] Prevent account creation if new user does not have allowed domain for the team (#14012)
* app/user: prevent user creation for restricted domains for a team * app/user_test: add error message checks to CreateUserWithInviteId
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
42081a1441
Коммит
4823b3861a
@@ -121,6 +121,10 @@ func (a *App) CreateUserWithInviteId(user *model.User, inviteId string) (*model.
|
||||
return nil, model.NewAppError("CreateUserWithInviteId", "app.team.invite_id.group_constrained.error", nil, "", http.StatusForbidden)
|
||||
}
|
||||
|
||||
if !CheckUserDomain(user, team.AllowedDomains) {
|
||||
return nil, model.NewAppError("CreateUserWithInviteId", "api.team.invite_members.invalid_email.app_error", map[string]interface{}{"Addresses": team.AllowedDomains}, "", http.StatusForbidden)
|
||||
}
|
||||
|
||||
user.EmailVerified = false
|
||||
|
||||
ruser, err := a.CreateUser(user)
|
||||
|
||||
Ссылка в новой задаче
Block a user