1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-14 14:14:25 +00:00

Apply DefaultUserIsRestricted in CreateUser

This commit is contained in:
Jimmy Praet 2022-04-01 19:26:49 +02:00
parent 7b4c3c7bb1
commit 9020faa3ce
3 changed files with 12 additions and 13 deletions

View File

@ -637,6 +637,7 @@ func CreateUser(u *User, overwriteDefault ...*CreateUserOverwriteOptions) (err e
u.EmailNotificationsPreference = setting.Admin.DefaultEmailNotification
u.MaxRepoCreation = -1
u.Theme = setting.UI.DefaultTheme
u.IsRestricted = u.IsRestricted || setting.Service.DefaultUserIsRestricted
// overwrite defaults if set
if len(overwriteDefault) != 0 && overwriteDefault[0] != nil {

View File

@ -507,11 +507,10 @@ func SignUpPost(ctx *context.Context) {
}
u := &user_model.User{
Name: form.UserName,
Email: form.Email,
Passwd: form.Password,
IsActive: !(setting.Service.RegisterEmailConfirm || setting.Service.RegisterManualConfirm),
IsRestricted: setting.Service.DefaultUserIsRestricted,
Name: form.UserName,
Email: form.Email,
Passwd: form.Password,
IsActive: !(setting.Service.RegisterEmailConfirm || setting.Service.RegisterManualConfirm),
}
if !createAndHandleCreatedUser(ctx, tplSignUp, form, u, nil, false) {

View File

@ -867,14 +867,13 @@ func SignInOAuthCallback(ctx *context.Context) {
return
}
u = &user_model.User{
Name: getUserName(&gothUser),
FullName: gothUser.Name,
Email: gothUser.Email,
IsActive: !setting.OAuth2Client.RegisterEmailConfirm,
LoginType: auth.OAuth2,
LoginSource: authSource.ID,
LoginName: gothUser.UserID,
IsRestricted: setting.Service.DefaultUserIsRestricted,
Name: getUserName(&gothUser),
FullName: gothUser.Name,
Email: gothUser.Email,
IsActive: !setting.OAuth2Client.RegisterEmailConfirm,
LoginType: auth.OAuth2,
LoginSource: authSource.ID,
LoginName: gothUser.UserID,
}
setUserGroupClaims(authSource, u, &gothUser)