-
12 Nov 2012 7:34 PM #1
Answered: [ASK] Have a problem with My Password Validation - 2
Answered: [ASK] Have a problem with My Password Validation - 2
Dear all ,
i have a problem with my password validation.
my current validation is using vtype and has its own pattern like this (2 uppercase + upper/lowercase + number) -> PAssword90 or PAssWord99
you will find this rule is not user friendly to be applied because user has to obey the pattern.
Once the pattern ignored (for example : number is placed in first string -> 90Password ), error message will appear.
here my vtype :
i want to create a rules (vtype or regEx) that allow user input their own password as long as containing one of Uppercase , number ,and symbols placed anywhere.Ext.form.VTypes=function()
{
k= /^([A-Z]{2})[A-Za-z\-]+[0-9_]+/;
return
{
passpos : function(e)
{
return k.test(e) },
passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka",
passposMask : /[A-Za-z0-9_]/i
}
}();
Example :
If you have any suggestion or idea , you may share it with us here.password -> wrong (not containing Uppercase , number and symbols)
Password -> wrong (not containing number and symbols)
pASsword -> wrong (not containing number and symbols)
pASsword90 -> wrong (not containing symbols)
pASsword90# -> correct
&pAssword99 -> correct
pas$90Word -> correct

-
Best Answer Posted by vietits
Try this:
Code:Ext.apply(Ext.form.field.VTypes, { passpos: function(v) { return /[A-Z]+/.test(v) && /[a-z]+/.test(v) && /[0-9]+/.test(v) && /[-_~!@#$%^&]+/.test(v); }, passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka", passposMask : /[A-Za-z0-9_]/i });
-
12 Nov 2012 9:03 PM #2
Try this:
Code:Ext.apply(Ext.form.field.VTypes, { passpos: function(v) { return /[A-Z]+/.test(v) && /[a-z]+/.test(v) && /[0-9]+/.test(v) && /[-_~!@#$%^&]+/.test(v); }, passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka", passposMask : /[A-Za-z0-9_]/i });
-
13 Nov 2012 2:04 AM #3


Reply With Quote


