andeya / goutil

Golang common tool functions and components.
MIT License
383 stars 82 forks source link

fix(password): Update the flag comparison #12

Closed ciphersaw closed 4 years ago

ciphersaw commented 4 years ago

The example CheckPassword("Aa12345", N|L_OR_U, 6) returned false before, but it returns true with the latest flag comparison logic.

The details of update is shown as following:

  1. Update the comments in password/password.go
  2. Update the test examples in password/password_test.go
  3. Update the flag comparison logic:
    • L_OR_U: It should include either the lowercase or the uppercase letter.
    • L_OR_U|L: It must include the lowercase letter, while the uppercase letter is optional.
    • L_OR_U|U: It must include the uppercase letter, while the lowercase letter is optional.
    • L_OR_U|L|U: It must include both the lowercase and the uppercase letter, which is equal to L|U.