Created
August 16, 2013 13:19
-
-
Save thirdj/6249919 to your computer and use it in GitHub Desktop.
strongPassword
From http://jsbin.com/aturor/3/edit
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 checkStrongPassword(pw){ | |
var msg3 = '33333333'; | |
var check = { | |
'length': false, | |
'charac': { | |
'upper': false, | |
'lower': false, | |
'special': false | |
}, | |
'number': false, | |
'repeat': false | |
}; | |
if(pw.length > 9) check.length = true; | |
if(pw.match(/[A-Z]/)) check.charac.upper = true; | |
if(pw.match(/[a-z]/)) check.charac.lower = true; | |
if(pw.match(/[\W_]/)) check.charac.special = true; | |
if(pw.match(/[0-9]/)) check.number = true; | |
if(pw.match(/(.)\1\1/)) check.repeat = true; | |
// repeat 확인 해야 할듯.. | |
if(!(check.length && check.charac && check.number && check.repeat)){ | |
alert(msg3); | |
return false; | |
} | |
return check.length && check.charac && check.number && check.repeat; | |
} | |
var pw = 'ee222e2qwe'; | |
if(checkStrongPassword(pw)){ | |
console.log('통과'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment