Fix SSPI user creation (#28948) (#29323)

Fixes #28945
Backport #28948

Setting the avatar is wrong and creating a random password is equal to
leave it empty.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 7ea2ffaf166780b7786291f7ff022e3f5b49e8c2)
This commit is contained in:
Lunny Xiao 2024-02-23 00:42:14 +08:00 committed by Earl Warren
parent 2a2b51c5f7
commit 790a27f38a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -11,7 +11,6 @@ import (
"sync" "sync"
"code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/avatars"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/base"
gitea_context "code.gitea.io/gitea/modules/context" gitea_context "code.gitea.io/gitea/modules/context"
@ -165,10 +164,7 @@ func (s *SSPI) newUser(ctx context.Context, username string, cfg *sspi.Source) (
user := &user_model.User{ user := &user_model.User{
Name: username, Name: username,
Email: email, Email: email,
Passwd: gouuid.New().String(),
Language: cfg.DefaultLanguage, Language: cfg.DefaultLanguage,
UseCustomAvatar: true,
Avatar: avatars.DefaultAvatarLink(),
} }
emailNotificationPreference := user_model.EmailNotificationsDisabled emailNotificationPreference := user_model.EmailNotificationsDisabled
overwriteDefault := &user_model.CreateUserOverwriteOptions{ overwriteDefault := &user_model.CreateUserOverwriteOptions{