mirror of
https://github.com/go-gitea/gitea
synced 2024-11-14 22:24:24 +00:00
Apply DefaultUserIsRestricted in CreateUser
This commit is contained in:
parent
7b4c3c7bb1
commit
9020faa3ce
@ -637,6 +637,7 @@ func CreateUser(u *User, overwriteDefault ...*CreateUserOverwriteOptions) (err e
|
|||||||
u.EmailNotificationsPreference = setting.Admin.DefaultEmailNotification
|
u.EmailNotificationsPreference = setting.Admin.DefaultEmailNotification
|
||||||
u.MaxRepoCreation = -1
|
u.MaxRepoCreation = -1
|
||||||
u.Theme = setting.UI.DefaultTheme
|
u.Theme = setting.UI.DefaultTheme
|
||||||
|
u.IsRestricted = u.IsRestricted || setting.Service.DefaultUserIsRestricted
|
||||||
|
|
||||||
// overwrite defaults if set
|
// overwrite defaults if set
|
||||||
if len(overwriteDefault) != 0 && overwriteDefault[0] != nil {
|
if len(overwriteDefault) != 0 && overwriteDefault[0] != nil {
|
||||||
|
@ -507,11 +507,10 @@ func SignUpPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u := &user_model.User{
|
u := &user_model.User{
|
||||||
Name: form.UserName,
|
Name: form.UserName,
|
||||||
Email: form.Email,
|
Email: form.Email,
|
||||||
Passwd: form.Password,
|
Passwd: form.Password,
|
||||||
IsActive: !(setting.Service.RegisterEmailConfirm || setting.Service.RegisterManualConfirm),
|
IsActive: !(setting.Service.RegisterEmailConfirm || setting.Service.RegisterManualConfirm),
|
||||||
IsRestricted: setting.Service.DefaultUserIsRestricted,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !createAndHandleCreatedUser(ctx, tplSignUp, form, u, nil, false) {
|
if !createAndHandleCreatedUser(ctx, tplSignUp, form, u, nil, false) {
|
||||||
|
@ -867,14 +867,13 @@ func SignInOAuthCallback(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
u = &user_model.User{
|
u = &user_model.User{
|
||||||
Name: getUserName(&gothUser),
|
Name: getUserName(&gothUser),
|
||||||
FullName: gothUser.Name,
|
FullName: gothUser.Name,
|
||||||
Email: gothUser.Email,
|
Email: gothUser.Email,
|
||||||
IsActive: !setting.OAuth2Client.RegisterEmailConfirm,
|
IsActive: !setting.OAuth2Client.RegisterEmailConfirm,
|
||||||
LoginType: auth.OAuth2,
|
LoginType: auth.OAuth2,
|
||||||
LoginSource: authSource.ID,
|
LoginSource: authSource.ID,
|
||||||
LoginName: gothUser.UserID,
|
LoginName: gothUser.UserID,
|
||||||
IsRestricted: setting.Service.DefaultUserIsRestricted,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setUserGroupClaims(authSource, u, &gothUser)
|
setUserGroupClaims(authSource, u, &gothUser)
|
||||||
|
Loading…
Reference in New Issue
Block a user