[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
This commit is contained in:
parent
6b3b6f1833
commit
74a0481586
10 changed files with 158 additions and 32 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue