Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Password checking related validation rules #1

Open
jwillp opened this issue Jan 24, 2020 · 0 comments · May be fixed by #21, #23, #22 or #26
Open

Add Password checking related validation rules #1

jwillp opened this issue Jan 24, 2020 · 0 comments · May be fixed by #21, #23, #22 or #26
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jwillp
Copy link
Contributor

jwillp commented Jan 24, 2020

Here are some levels used by applications to determine the strength of a password:

  1. Very weak: any character is allowed (example: "1234567890" or "qwerty")
  2. Weak: at least one lower and one upper
  3. Medium: at least one lower, one upper and one number
  4. Strong: at least one lower, one upper, one number and one special character
  5. Very strong: at least one lower, one upper, one number, one special character and a minimal length of 12

In order to support these various requirements, the following rules would be needed:

// Where numberCharacters means the number of required characters to match  
// strict = true means at most the provided number 
// while strict = false means at least the number of characters provided
new ContainsUppercaseCharacters($numberCharacters = 1, $strict = false, $message = null); 
new ContainsLowercaseCharacters($numberCharacters = 1, $strict = false, $message = null);
new ContainsNumericCharacters($numberCharacters = 1, $strict = false, $message = null);
// For Special characters, to allow users of the library to define their own set of special chars
new MatchesRegex($regex, $message);

// Min Length
new MinLength($length, $message);
new Length($length, $message); // For Exact length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
1 participant