summaryrefslogtreecommitdiffstats
path: root/services/auth/sspi_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/auth/sspi_windows.go')
-rw-r--r--services/auth/sspi_windows.go26
1 files changed, 15 insertions, 11 deletions
diff --git a/services/auth/sspi_windows.go b/services/auth/sspi_windows.go
index 63e70e61d4..9bc4041a74 100644
--- a/services/auth/sspi_windows.go
+++ b/services/auth/sspi_windows.go
@@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
+ "code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web/middleware"
"code.gitea.io/gitea/services/auth/source/sspi"
"code.gitea.io/gitea/services/mailer"
@@ -187,17 +188,20 @@ func (s *SSPI) shouldAuthenticate(req *http.Request) (shouldAuth bool) {
func (s *SSPI) newUser(username string, cfg *sspi.Source) (*user_model.User, error) {
email := gouuid.New().String() + "@localhost.localdomain"
user := &user_model.User{
- Name: username,
- Email: email,
- KeepEmailPrivate: true,
- Passwd: gouuid.New().String(),
- IsActive: cfg.AutoActivateUsers,
- Language: cfg.DefaultLanguage,
- UseCustomAvatar: true,
- Avatar: avatars.DefaultAvatarLink(),
- EmailNotificationsPreference: user_model.EmailNotificationsDisabled,
- }
- if err := user_model.CreateUser(user); err != nil {
+ Name: username,
+ Email: email,
+ Passwd: gouuid.New().String(),
+ Language: cfg.DefaultLanguage,
+ UseCustomAvatar: true,
+ Avatar: avatars.DefaultAvatarLink(),
+ }
+ emailNotificationPreference := user_model.EmailNotificationsDisabled
+ overwriteDefault := &user_model.CreateUserOverwriteOptions{
+ IsActive: util.OptionalBoolOf(cfg.AutoActivateUsers),
+ KeepEmailPrivate: util.OptionalBoolTrue,
+ EmailNotificationsPreference: &emailNotificationPreference,
+ }
+ if err := user_model.CreateUser(user, overwriteDefault); err != nil {
return nil, err
}