mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-27 04:07:08 +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:
parent
eb0359cad4
commit
c57edb6c7b
9 changed files with 72 additions and 24 deletions
|
@ -96,7 +96,7 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
|
|||
}
|
||||
if u.LoginType == models.LoginPlain {
|
||||
if !password.IsComplexEnough(form.Password) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplUserNew, &form)
|
||||
ctx.RenderWithErr(password.BuildComplexityError(ctx), tplUserNew, &form)
|
||||
return
|
||||
}
|
||||
u.MustChangePassword = form.MustChangePassword
|
||||
|
@ -208,7 +208,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
|
|||
return
|
||||
}
|
||||
if !password.IsComplexEnough(form.Password) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplUserEdit, &form)
|
||||
ctx.RenderWithErr(password.BuildComplexityError(ctx), tplUserEdit, &form)
|
||||
return
|
||||
}
|
||||
u.HashPassword(form.Password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue