sync
This commit is contained in:
@@ -53,19 +53,24 @@ function isPhone(text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyPassword(password, min) {
|
||||
function getPasswordStrength(password) {
|
||||
if (password == null || typeof password !== 'string') {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
if (password.length < 8) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
min ??= 3;
|
||||
let secure = 0;
|
||||
if (/[0-9]/.test(password)) { secure++ }
|
||||
if (/[a-z]/.test(password)) { secure++ }
|
||||
if (/[A-Z]/.test(password)) { secure++ }
|
||||
if (/[^0-9a-zA-Z]/.test(password)) { secure++ }
|
||||
return secure;
|
||||
}
|
||||
|
||||
function verifyPassword(password, min) {
|
||||
min ??= 3;
|
||||
const secure = getPasswordStrength(password);
|
||||
return secure >= min;
|
||||
}
|
||||
|
||||
@@ -100,6 +105,7 @@ export {
|
||||
truncate,
|
||||
isEmail,
|
||||
isPhone,
|
||||
getPasswordStrength,
|
||||
verifyPassword,
|
||||
domLoad
|
||||
}
|
||||
Reference in New Issue
Block a user