Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 8x 8x 52x 8x 8x 8x 7x | const SPECIAL_CHARACTERS = "!@#$%^&*()_+-=[]{};':\"\\|,.<>/?";
export function getPasswordChecks(password = "") {
const value = String(password);
const categories = {
lower: /[a-z]/.test(value),
upper: /[A-Z]/.test(value),
number: /[0-9]/.test(value),
special: [...value].some((character) => SPECIAL_CHARACTERS.includes(character)),
};
const categoryCount = Object.values(categories).filter(Boolean).length;
const length = value.length >= 8 && value.length <= 20;
return {
...categories,
length,
categoryCount,
valid: length && categoryCount >= 3,
};
}
export function isStrongPassword(password) {
return getPasswordChecks(password).valid;
}
|