summaryrefslogtreecommitdiffstats
path: root/routers/user/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r--routers/user/auth.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 540a0d2f1a..bce801847d 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -1517,11 +1517,10 @@ func ResetPasswdPost(ctx *context.Context) {
ctx.ServerError("UpdateUser", err)
return
}
- if u.Salt, err = models.GetUserSalt(); err != nil {
+ if err = u.SetPassword(passwd); err != nil {
ctx.ServerError("UpdateUser", err)
return
}
- u.HashPassword(passwd)
u.MustChangePassword = false
if err := models.UpdateUserCols(u, "must_change_password", "passwd", "passwd_hash_algo", "rands", "salt"); err != nil {
ctx.ServerError("UpdateUser", err)
@@ -1591,12 +1590,11 @@ func MustChangePasswordPost(ctx *context.Context, cpt *captcha.Captcha, form aut
}
var err error
- if u.Salt, err = models.GetUserSalt(); err != nil {
+ if err = u.SetPassword(form.Password); err != nil {
ctx.ServerError("UpdateUser", err)
return
}
- u.HashPassword(form.Password)
u.MustChangePassword = false
if err := models.UpdateUserCols(u, "must_change_password", "passwd", "passwd_hash_algo", "salt"); err != nil {