summaryrefslogtreecommitdiffstats
path: root/services/auth/source/pam
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2022-04-29 21:38:11 +0200
committerGitHub <noreply@github.com>2022-04-29 15:38:11 -0400
commit5aebc4f000354d9fa448033445c6f313f4c6ab08 (patch)
treec081c5eff890a454b4c4c3a6aa9d1329eba09052 /services/auth/source/pam
parent219c87e7d889f5c62097968e5ec8ad04f244cd3c (diff)
downloadgitea-5aebc4f000354d9fa448033445c6f313f4c6ab08.tar.gz
gitea-5aebc4f000354d9fa448033445c6f313f4c6ab08.zip
Respect DefaultUserIsRestricted system default when creating new user (#19310)
* Apply DefaultUserIsRestricted in CreateUser * Enforce system defaults in CreateUser Allow for overwrites with CreateUserOverwriteOptions * Fix compilation errors * Add "restricted" option to create user command * Add "restricted" option to create user admin api * Respect default setting.Service.RegisterEmailConfirm and setting.Service.RegisterManualConfirm where needed * Revert "Respect default setting.Service.RegisterEmailConfirm and setting.Service.RegisterManualConfirm where needed" This reverts commit ee95d3e8dc9e9fff4fa66a5111e4d3930280e033.
Diffstat (limited to 'services/auth/source/pam')
-rw-r--r--services/auth/source/pam/source_authenticate.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/services/auth/source/pam/source_authenticate.go b/services/auth/source/pam/source_authenticate.go
index d5bd940996..16ddc0598e 100644
--- a/services/auth/source/pam/source_authenticate.go
+++ b/services/auth/source/pam/source_authenticate.go
@@ -12,6 +12,7 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/auth/pam"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/mailer"
"github.com/google/uuid"
@@ -58,10 +59,12 @@ func (source *Source) Authenticate(user *user_model.User, userName, password str
LoginType: auth.PAM,
LoginSource: source.authSource.ID,
LoginName: userName, // This is what the user typed in
- IsActive: true,
+ }
+ overwriteDefault := &user_model.CreateUserOverwriteOptions{
+ IsActive: util.OptionalBoolTrue,
}
- if err := user_model.CreateUser(user); err != nil {
+ if err := user_model.CreateUser(user, overwriteDefault); err != nil {
return user, err
}