Skip to content

Commit 3003bee

Browse files
committed
let SetPassword("") unset pwd stuff
1 parent e0bbf54 commit 3003bee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

models/user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,10 @@ func hashPassword(passwd, salt, algo string) string {
399399
// change passwd, salt and passwd_hash_algo fields
400400
func (u *User) SetPassword(passwd string) (err error) {
401401
if len(passwd) == 0 {
402-
return fmt.Errorf("no passord to be set")
402+
u.Passwd = ""
403+
u.Salt = ""
404+
u.PasswdHashAlgo = ""
405+
return nil
403406
}
404407

405408
if u.Salt, err = GetUserSalt(); err != nil {

0 commit comments

Comments
 (0)