|
|
@ -1,12 +1,10 @@ |
|
|
|
export function validatePassword(p) { |
|
|
|
export function validatePassword(p) { |
|
|
|
let error = ''; |
|
|
|
let error = ''; |
|
|
|
let progress = 0; |
|
|
|
|
|
|
|
let hint = null; |
|
|
|
let hint = null; |
|
|
|
let valid = true; |
|
|
|
let valid = true; |
|
|
|
|
|
|
|
|
|
|
|
if (!p) { |
|
|
|
if (!p) { |
|
|
|
error = |
|
|
|
error = 'At least 8 letters'; |
|
|
|
'At least 8 letters with one Uppercase, one number and one special letter'; |
|
|
|
|
|
|
|
// error = t('msg.error.signUpRules.completeRuleSet');
|
|
|
|
// error = t('msg.error.signUpRules.completeRuleSet');
|
|
|
|
valid = false; |
|
|
|
valid = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -14,37 +12,7 @@ export function validatePassword(p) { |
|
|
|
error += 'At least 8 letters. '; |
|
|
|
error += 'At least 8 letters. '; |
|
|
|
// error += t('msg.error.signUpRules.atLeast8Char');
|
|
|
|
// error += t('msg.error.signUpRules.atLeast8Char');
|
|
|
|
valid = false; |
|
|
|
valid = false; |
|
|
|
} else { |
|
|
|
|
|
|
|
progress = Math.min(100, progress + 25); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!p.match(/.*[A-Z].*/)) { |
|
|
|
|
|
|
|
error += 'One Uppercase Letter. '; |
|
|
|
|
|
|
|
// error += t('msg.error.signUpRules.atLeastOneUppercase');
|
|
|
|
|
|
|
|
valid = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
progress = Math.min(100, progress + 25); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!p.match(/.*[0-9].*/)) { |
|
|
|
|
|
|
|
error += 'One Number. '; |
|
|
|
|
|
|
|
// error += t('msg.error.signUpRules.atLeastOneNumber');
|
|
|
|
|
|
|
|
valid = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
progress = Math.min(100, progress + 25); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!p.match(/[$&+,:;=?@#|'<>.^*()%!_-]/)) { |
|
|
|
|
|
|
|
error += 'One special letter. '; |
|
|
|
|
|
|
|
// error += t('msg.error.signUpRules.atLeastOneSpecialChar');
|
|
|
|
|
|
|
|
hint = "Allowed special character list : $&+,:;=?@#|'<>.^*()%!_-"; |
|
|
|
|
|
|
|
// hint = `${t(
|
|
|
|
|
|
|
|
// 'msg.error.signUpRules.allowedSpecialCharList'
|
|
|
|
|
|
|
|
// )} : $&+,:;=?@#|'<>.^*()%!_-`;
|
|
|
|
|
|
|
|
valid = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
progress = Math.min(100, progress + 25); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return { error, valid, progress, hint }; |
|
|
|
return { error, valid, hint }; |
|
|
|
} |
|
|
|
} |
|
|
|