Browse Source

Backport: Fix password complexity check on registration (#8887) (#8888)

* Fix registration password complexity

* Fix integration to use a complex password ;)
tags/v1.10.0
guillep2k 4 years ago
parent
commit
fbcf235633
2 changed files with 7 additions and 2 deletions
  1. 2
    2
      integrations/signup_test.go
  2. 5
    0
      routers/user/auth.go

+ 2
- 2
integrations/signup_test.go View File

req := NewRequestWithValues(t, "POST", "/user/sign_up", map[string]string{ req := NewRequestWithValues(t, "POST", "/user/sign_up", map[string]string{
"user_name": "exampleUser", "user_name": "exampleUser",
"email": "exampleUser@example.com", "email": "exampleUser@example.com",
"password": "examplePassword",
"retype": "examplePassword",
"password": "examplePassword!1",
"retype": "examplePassword!1",
}) })
MakeRequest(t, req, http.StatusFound) MakeRequest(t, req, http.StatusFound)



+ 5
- 0
routers/user/auth.go View File

ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplSignUp, &form) ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplSignUp, &form)
return return
} }
if !password.IsComplexEnough(form.Password) {
ctx.Data["Err_Password"] = true
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplSignUp, &form)
return
}


u := &models.User{ u := &models.User{
Name: form.UserName, Name: form.UserName,

Loading…
Cancel
Save