summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-01-11 23:19:38 +0100
committerLauris BH <lauris@nix.lv>2018-01-12 00:19:38 +0200
commite5b8b4b5ec076b100b86845d2b4a8ff7ff71a87a (patch)
treecbd22852523b05ad2e6472f65228b9b4822c2f05 /routers/user
parent9aed18073dd825c7bcd00aef39ef282fec863796 (diff)
downloadgitea-e5b8b4b5ec076b100b86845d2b4a8ff7ff71a87a.tar.gz
gitea-e5b8b4b5ec076b100b86845d2b4a8ff7ff71a87a.zip
Cleanup models.User.HashPassword (#3334)
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/auth.go3
-rw-r--r--routers/user/setting.go3
2 files changed, 2 insertions, 4 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index c3fb911b07..6edcb914b1 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -984,7 +984,6 @@ func ResetPasswdPost(ctx *context.Context) {
return
}
- u.Passwd = passwd
var err error
if u.Rands, err = models.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
@@ -994,7 +993,7 @@ func ResetPasswdPost(ctx *context.Context) {
ctx.ServerError("UpdateUser", err)
return
}
- u.HashPassword()
+ u.HashPassword(passwd)
if err := models.UpdateUserCols(u, "passwd", "rands", "salt"); err != nil {
ctx.ServerError("UpdateUser", err)
return
diff --git a/routers/user/setting.go b/routers/user/setting.go
index dcd0eedb8d..b674c24b44 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -229,13 +229,12 @@ func SettingsSecurityPost(ctx *context.Context, form auth.ChangePasswordForm) {
} else if form.Password != form.Retype {
ctx.Flash.Error(ctx.Tr("form.password_not_match"))
} else {
- ctx.User.Passwd = form.Password
var err error
if ctx.User.Salt, err = models.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
return
}
- ctx.User.HashPassword()
+ ctx.User.HashPassword(form.Password)
if err := models.UpdateUserCols(ctx.User, "salt", "passwd"); err != nil {
ctx.ServerError("UpdateUser", err)
return