1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

[GITEA] Add password length check on install page

- Resolves #271
- Ensure that the adminstrator password is at least `MIN_PASSWORD_LENGTH`.

(cherry picked from commit 28cb04c3f5)
(cherry picked from commit 95371ebd92)
This commit is contained in:
Gusted 2023-06-24 13:08:52 +02:00 committed by Earl Warren
parent 5ced68a7a0
commit a134288ab6
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -361,6 +361,12 @@ func SubmitInstall(ctx *context.Context) {
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), tplInstall, form) ctx.RenderWithErr(ctx.Tr("form.password_not_match"), tplInstall, form)
return return
} }
if len(form.AdminPasswd) < setting.MinPasswordLength {
ctx.Data["Err_Admin"] = true
ctx.Data["Err_AdminPasswd"] = true
ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplInstall, form)
return
}
} }
// Init the engine with migration // Init the engine with migration