diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-11-19 19:44:58 -0300 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-11-19 22:44:58 +0000 |
commit | c57edb6c7b5066da2b0f526e6ab9f7842fd785fb (patch) | |
tree | 68d44a4dbc58f8ade1373eb30fe850410511ce43 /modules/password/password_test.go | |
parent | eb0359cad4b725553c8bca3e95ada9c789c5da0b (diff) | |
download | gitea-c57edb6c7b5066da2b0f526e6ab9f7842fd785fb.tar.gz gitea-c57edb6c7b5066da2b0f526e6ab9f7842fd785fb.zip |
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>
Diffstat (limited to 'modules/password/password_test.go')
-rw-r--r-- | modules/password/password_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/password/password_test.go b/modules/password/password_test.go index d46a6d1571..4325086b50 100644 --- a/modules/password/password_test.go +++ b/modules/password/password_test.go @@ -18,6 +18,7 @@ func TestComplexity_IsComplexEnough(t *testing.T) { truevalues []string falsevalues []string }{ + {[]string{"off"}, []string{"1", "-", "a", "A", "ñ", "日本語"}, []string{}}, {[]string{"lower"}, []string{"abc", "abc!"}, []string{"ABC", "123", "=!$", ""}}, {[]string{"upper"}, []string{"ABC"}, []string{"abc", "123", "=!$", "abc!", ""}}, {[]string{"digit"}, []string{"123"}, []string{"abc", "ABC", "=!$", "abc!", ""}}, @@ -25,6 +26,7 @@ func TestComplexity_IsComplexEnough(t *testing.T) { {[]string{"off"}, []string{"abc", "ABC", "123", "=!$", "abc!", ""}, nil}, {[]string{"lower", "spec"}, []string{"abc!"}, []string{"abc", "ABC", "123", "=!$", "abcABC123", ""}}, {[]string{"lower", "upper", "digit"}, []string{"abcABC123"}, []string{"abc", "ABC", "123", "=!$", "abc!", ""}}, + {[]string{""}, []string{"abC=1", "abc!9D"}, []string{"ABC", "123", "=!$", ""}}, } for _, test := range testlist { @@ -70,6 +72,6 @@ func TestComplexity_Generate(t *testing.T) { func testComplextity(values []string) { // Cleanup previous values validChars = "" - requiredChars = make([]string, 0, len(values)) + requiredList = make([]complexity, 0, len(values)) setupComplexity(values) } |