summaryrefslogtreecommitdiffstats
path: root/models/login_source.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-01-10 19:05:18 +0100
committerGitHub <noreply@github.com>2021-01-10 20:05:18 +0200
commit74a0481586b7035bbe7a82f6e7e275cdd87d382a (patch)
tree1e0a0c40619529bcc2c32ceaf007fafc0f565dfd /models/login_source.go
parent6b3b6f1833d07383d24d68ec220a18315ac36809 (diff)
downloadgitea-74a0481586b7035bbe7a82f6e7e275cdd87d382a.tar.gz
gitea-74a0481586b7035bbe7a82f6e7e275cdd87d382a.zip
[Refactor] Passwort Hash/Set (#14282)
* move SaltGeneration into HashPasswort and rename it to what it does * Migration: Where Password is Valid with Empty String delete it * prohibit empty password hash * let SetPassword("") unset pwd stuff
Diffstat (limited to 'models/login_source.go')
-rw-r--r--models/login_source.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/models/login_source.go b/models/login_source.go
index f1941c3e78..d351f12861 100644
--- a/models/login_source.go
+++ b/models/login_source.go
@@ -771,8 +771,10 @@ func UserSignIn(username, password string) (*User, error) {
// Update password hash if server password hash algorithm have changed
if user.PasswdHashAlgo != setting.PasswordHashAlgo {
- user.HashPassword(password)
- if err := UpdateUserCols(user, "passwd", "passwd_hash_algo"); err != nil {
+ if err = user.SetPassword(password); err != nil {
+ return nil, err
+ }
+ if err = UpdateUserCols(user, "passwd", "passwd_hash_algo", "salt"); err != nil {
return nil, err
}
}