Skip to content

Instantly share code, notes, and snippets.

@lffsantos
Created January 14, 2019 16:18
Show Gist options
  • Save lffsantos/f6ace91250aab15351cc289dcf5943d5 to your computer and use it in GitHub Desktop.
Save lffsantos/f6ace91250aab15351cc289dcf5943d5 to your computer and use it in GitHub Desktop.
validate_password(password) {
let minMaxLength = /^[\s\S]{8,32}$/,
upper = /[A-Z]/,
lower = /[a-z]/,
number = /[0-9]/,
special = /[ !"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/;
if (minMaxLength.test(password) &&
upper.test(password) &&
lower.test(password) &&
number.test(password) &&
special.test(password)
) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment