Created
September 13, 2019 03:48
-
-
Save notgull/1d8ed6fad237630e07fd231e747d75bb 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
var check_password_compat = function(pw) { | |
var ch, code; | |
var specialChars = ['-', '_', '?', '!']; | |
for (var i = 0; i < pw.length; i++) { | |
ch = pw[i]; | |
code = ch.charCodeAt(ch); | |
var isUppercaseLetter = 65 <= code && code <= 90; | |
var isLowercaseLetter = 97 <= code && code <= 122; | |
var isNumber = 48 <= code && code <= 57; | |
var isSpecialChar = specialChars.indexOf(ch) !== -1; | |
if (!(isUppercaseLetter || isLowercaseLetter || isNumber || isSpecialChar)) return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment