Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify user update methods #28733

Merged
merged 12 commits into from
Feb 4, 2024
Prev Previous commit
Next Next commit
Merge branch 'main' of https://github.com/go-gitea/gitea into refacto…
…r-user-service
  • Loading branch information
KN4CK3R committed Jan 26, 2024
commit f339316f154748e3cb53cb2ad81b7b35aa66c6ec
9 changes: 7 additions & 2 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,13 @@ func CreateUser(ctx context.Context, u *User, overwriteDefault ...*CreateUserOve
if u.Rands, err = GetUserSalt(); err != nil {
return err
}
if err = u.SetPassword(u.Passwd); err != nil {
return err
if u.Passwd != "" {
if err = u.SetPassword(u.Passwd); err != nil {
return err
}
} else {
u.Salt = ""
u.PasswdHashAlgo = ""
}

// save changes to database
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.