Created
April 9, 2014 06:43
-
-
Save jorben/10232736 to your computer and use it in GitHub Desktop.
分三级区分密码强度
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
/** | |
* 密码强度等级验证 | |
*/ | |
function valid_strong_password (password) { | |
if (password.length < 6 || parseInt(password) == password || /^[a-zA-Z]+$/.test(password) || /^[^a-zA-Z0-9]+$/.test(password)) { | |
return 0; | |
} | |
if (/^.{6,7}$/.test(password) || !/[0-9]/.exec(password) || !/[a-z]/.exec(password) || !/[A-Z]/.exec(password)) { | |
return 1; | |
} | |
return 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment