Created
May 24, 2021 17:53
-
-
Save brunokiafuka/ea841ff9a0433b8364a3296b0813636d to your computer and use it in GitHub Desktop.
Check Password Strength.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const strongPassword = new RegExp( | |
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})' | |
); | |
const mediumPassword = new RegExp( | |
'^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})' | |
); | |
export const isPasswordStrong = (value = ''): boolean => { | |
if (strongPassword.test(value)) { | |
return true; | |
} | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment