Created
April 3, 2015 12:27
-
-
Save ziyahan/08d98b806743b14d2356 to your computer and use it in GitHub Desktop.
Test Passwd
This file contains hidden or 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
testPassword = function (password) { | |
var minLengthMet = password.length >= 8, | |
hasUpper = (/[A-Z]+/).test(password), | |
hasLower = (/[a-z]+/).test(password), | |
hasNumber = (/[0-9]+/).test(password), | |
letterBegin = (/^[A-Za-z]/).test(password), | |
noSpecials = !(/[^A-Za-z0-9]+/).test(password); | |
logIndividualTests(minLengthMet, hasUpper, hasLower, hasNumber, letterBegin, noSpecials); | |
return minLengthMet && hasUpper && hasLower && hasNumber && letterBegin && noSpecials; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment