mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Change EncodePasswd to HashPassword (#3329)
* Change EncodePasswd to HashPassword * Create test+benchmark for HashPassword
This commit is contained in:
committed by
Kim "BKC" Carlbäcker
parent
f2b841d0ec
commit
674cfb7cac
@@ -200,7 +200,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
}
|
||||
u.EncodePasswd()
|
||||
u.HashPassword()
|
||||
}
|
||||
|
||||
u.LoginName = form.LoginName
|
||||
|
@@ -132,7 +132,7 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
|
||||
ctx.Error(500, "UpdateUser", err)
|
||||
return
|
||||
}
|
||||
u.EncodePasswd()
|
||||
u.HashPassword()
|
||||
}
|
||||
|
||||
u.LoginName = form.LoginName
|
||||
|
@@ -994,7 +994,7 @@ func ResetPasswdPost(ctx *context.Context) {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
}
|
||||
u.EncodePasswd()
|
||||
u.HashPassword()
|
||||
if err := models.UpdateUserCols(u, "passwd", "rands", "salt"); err != nil {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
|
@@ -235,7 +235,7 @@ func SettingsSecurityPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
}
|
||||
ctx.User.EncodePasswd()
|
||||
ctx.User.HashPassword()
|
||||
if err := models.UpdateUserCols(ctx.User, "salt", "passwd"); err != nil {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user