How does extjs verify the password?
Implementation 1:
**************************************** *********
Ext. Apply (ext. Form. vtypes ,{
Confirmpwd: function (Val, field ){
If (field. confirmpwd ){
VaR firstpwdid = field. confirmpwd. first;
VaR secondpwdid = field. confirmpwd. Second;
This. firstfield = ext. getcmp (firstpwdid );
This. secondfield = ext. getcmp (secondpwdid );
VaR firstpwd = This. firstfield. getvalue ();
VaR secondpwd = This. secondfield. getvalue ();
If (firstpwd = secondpwd ){
Return true;
} Else {
Return false;
}
}
},
Confirmpwdtext: 'The two passwords are inconsistent! '
});
========================================================== ==========
{
ID: 'Password ',
Name: 'Password ',
Width: 140,
Fieldlabel: '<font color = "red"> password & nbsp; Code </font> ',
// Confirmpwd :{
// First: 'Password ',
// Second: 'confirmpassword'
//},
// Inputtype: 'Password ',
// Vtype: 'confirmpwd ',
Allowblank: false,
Blanktext: 'password cannot be blank ',
RegEx:/^ [\ s] {0, 20} $ /,
Regextext: 'password length cannot exceed 20 characters'
},{
ID: 'confirmpassword ',
Name: 'confirmpassword ',
Width: 140,
Fieldlabel: '<font color = "red"> Confirm Password </font> ',
Confirmpwd :{
First: 'Password ',
Second: 'confirmpassword'
},
// Inputtype: 'Password ',
Vtype: 'confirmpwd ',
Allowblank: false,
Blanktext: 'Confirm password cannot be blank ',
RegEx:/^ [\ s] {0, 20} $ /,
Regextext: 'Confirm that the password length cannot exceed 20 characters'
}
Bytes -----------------------------------------------------------------------------------------------------
Implementation 2:
**************************************** *********
Ext. Apply (ext. Form. vtypes ,{
Password: function (Val, field ){
If (field. initialpassfield ){
VaR Pwd = ext. getcmp (field. initialpassfield );
Return (val = PWD. getvalue ());
}
Return true;
},
Passwordtext: 'The passwords entered twice are inconsistent! '
});
========================================================== ==========
{
ID: 'newpwd ',
Name: 'newpwd ',
Width: 140,
Inputtype: 'Password ',
Fieldlabel: '<font color = "red"> New Password </font> ',
Allowblank: false,
Blanktext: 'the new password cannot be blank ',
RegEx:/^ [\ s] {0, 12} $ /,
Regextext: 'the new password cannot exceed 12 characters'
},{
Name: 'confirmpwd ',
Width: 140,
Inputtype: 'Password ',
Fieldlabel: '<font color = "red"> Confirm Password </font> ',
Vtype: 'Password ',
Initialpassfield: 'newpwd ',
Allowblank: false,
Blanktext: 'Confirm password cannot be blank ',
RegEx:/^ [\ s] {0, 12} $ /,
Regextext: 'The old password cannot exceed 12 characters'
}
Ext. Apply (ext. Form. Field. vtypes ,{
Daterange: function (Val, field ){
VaR date = field. parsedate (VAL );
If (! Date ){
Return false;
}
If (field. startdatefield &&(! This. daterangemax | (date. gettime ()! = This. daterangemax. gettime ()))){
VaR start = field. Up ('form'). Down ('#' + field. startdatefield );
Start. setmaxvalue (date );
Start. Validate ();
This. daterangemax = date;
}
Else if (field. enddatefield &&(! This. daterangemin | (date. gettime ()! = This. daterangemin. gettime ()))){
VaR end = field. Up ('form'). Down ('#' + field. enddatefield );
End. setminvalue (date );
End. Validate ();
This. daterangemin = date;
}
/*
* Always return true since we're only using this vtype to set
* Min/MAX allowed values (these are tested for after the vtype test)
*/
Return true;
},
Daterangetext: 'start date must be less than or equal to end date ',
Password: function (Val, field ){
If (field. initialpassfield ){
VaR Pwd = field. Up ('form'). Down ('#' + field. initialpassfield );
Return (val = PWD. getvalue ());
}
Return true;
},
Passwordtext: 'password mismatch'
});