1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-03-17 21:17:57 +02:00

Fix default.Rules lowercase condition

This commit is contained in:
Rodrigo Argüello Flores 2018-11-10 19:36:44 +09:00
parent 87b06f40ed
commit 63e9512667
No known key found for this signature in database
GPG Key ID: 1AF0BFFAB2EA5F95
2 changed files with 6 additions and 1 deletions

View File

@ -56,7 +56,7 @@ func (r Rules) Errors(toValidate string) authboss.ErrorList {
if upper < r.MinUpper {
errs = append(errs, FieldError{r.FieldName, errors.New(r.upperErr())})
}
if upper < r.MinLower {
if lower < r.MinLower {
errs = append(errs, FieldError{r.FieldName, errors.New(r.lowerErr())})
}
if numeric < r.MinNumeric {

View File

@ -48,6 +48,11 @@ func TestRules_Errors(t *testing.T) {
"hi",
"email: Must be between 3 and 5 characters",
},
{
Rules{FieldName: "email", MinUpper: 2, MinLower: 1},
"AA",
"email: Must contain at least 1 lowercase letter",
},
{
Rules{FieldName: "email", MinLetters: 5},
"13345",