mirror of
https://github.com/go-gitea/gitea
synced 2025-07-29 21:58:36 +00:00
Add password requirement info on error (#9074)
* Add password requirement info on error * Move BuildComplexityError to the password pkg * Unexport complexity type * Fix extra line * Update modules/password/password.go Co-Authored-By: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -53,7 +53,7 @@ func AccountPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
||||
} else if form.Password != form.Retype {
|
||||
ctx.Flash.Error(ctx.Tr("form.password_not_match"))
|
||||
} else if !password.IsComplexEnough(form.Password) {
|
||||
ctx.Flash.Error(ctx.Tr("form.password_complexity"))
|
||||
ctx.Flash.Error(password.BuildComplexityError(ctx))
|
||||
} else {
|
||||
var err error
|
||||
if ctx.User.Salt, err = models.GetUserSalt(); err != nil {
|
||||
|
@@ -91,7 +91,7 @@ func TestChangePassword(t *testing.T) {
|
||||
Retype: req.Retype,
|
||||
})
|
||||
|
||||
assert.EqualValues(t, req.Message, ctx.Flash.ErrorMsg)
|
||||
assert.Contains(t, ctx.Flash.ErrorMsg, req.Message)
|
||||
assert.EqualValues(t, http.StatusFound, ctx.Resp.Status())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user