Custom password validation strength based on password poloices
<aui:input id="newPassword" name="newPassword" type="password"
placeholder="New Password" label="">
<aui:validator name="custom" errorMessage="Password should contain atleast one
(Uppercase Letter,lowercase Letter,Numeric digit and Symbol)" >
function(val, fieldNode, ruleValue) {
var passwordPattern = new RegExp("(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@#$^&*!~])");
var result = passwordPattern.test(val);
if(result){
return result;
}else{
return result;
}
}
</aui:validator>
</aui:input>
- Lowercase character eg:RegExp (?=.*[a-z])
- Uppercase character eg:RegExp (?=.*[A-Z])
- Digit eg:RegExp (?=.*[0-9])
- Symbol eg:RegExp (?=.*[@#$^&*!~])
<aui:input id="newPassword" name="newPassword" type="password"
placeholder="New Password" label="">
<aui:validator name="custom" errorMessage="Password should contain atleast one
(Uppercase Letter,lowercase Letter,Numeric digit and Symbol)" >
function(val, fieldNode, ruleValue) {
var passwordPattern = new RegExp("(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@#$^&*!~])");
var result = passwordPattern.test(val);
if(result){
return result;
}else{
return result;
}
}
</aui:validator>
</aui:input>
No comments:
Post a Comment