@@ -203,6 +203,11 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
203203 ctx .RenderWithErr (ctx .Tr ("form.password_not_match" ), tplSignUp , & form )
204204 return
205205 }
206+ if len (form .Password ) < setting .MinPasswordLength {
207+ ctx .Data ["Err_Password" ] = true
208+ ctx .RenderWithErr (ctx .Tr ("auth.password_too_short" , setting .MinPasswordLength ), tplSignUp , & form )
209+ return
210+ }
206211
207212 u := & models.User {
208213 Name : form .UserName ,
@@ -410,7 +415,7 @@ func ResetPasswd(ctx *context.Context) {
410415 ctx .HTML (200 , tplResetPassword )
411416}
412417
413- // ResetPasswdPost response fro reset password request
418+ // ResetPasswdPost response from reset password request
414419func ResetPasswdPost (ctx * context.Context ) {
415420 ctx .Data ["Title" ] = ctx .Tr ("auth.reset_password" )
416421
@@ -424,10 +429,10 @@ func ResetPasswdPost(ctx *context.Context) {
424429 if u := models .VerifyUserActiveCode (code ); u != nil {
425430 // Validate password length.
426431 passwd := ctx .Query ("password" )
427- if len (passwd ) < 6 {
432+ if len (passwd ) < setting . MinPasswordLength {
428433 ctx .Data ["IsResetForm" ] = true
429434 ctx .Data ["Err_Password" ] = true
430- ctx .RenderWithErr (ctx .Tr ("auth.password_too_short" ), tplResetPassword , nil )
435+ ctx .RenderWithErr (ctx .Tr ("auth.password_too_short" , setting . MinPasswordLength ), tplResetPassword , nil )
431436 return
432437 }
433438
0 commit comments