make use of checkPassword() in server_privileges.js instead of own function
This commit is contained in:
@@ -8,32 +8,40 @@
|
||||
/**
|
||||
* Validates the password field in a form
|
||||
*
|
||||
* @uses jsPasswordEmpty
|
||||
* @uses jsPasswordNotSame
|
||||
* @param object the form
|
||||
*
|
||||
* @return boolean whether the field value is valid or not
|
||||
*/
|
||||
function checkPassword(the_form)
|
||||
{
|
||||
// Did the user select 'no password'?
|
||||
if (typeof(the_form.elements['nopass']) != 'undefined' && the_form.elements['nopass'][0].checked) {
|
||||
if (typeof(the_form.elements['nopass']) != 'undefined'
|
||||
&& the_form.elements['nopass'][0].checked) {
|
||||
return true;
|
||||
} else if (typeof(the_form.elements['pred_password']) != 'undefined' && (the_form.elements['pred_password'].value == 'none' || the_form.elements['pred_password'].value == 'keep')) {
|
||||
} else if (typeof(the_form.elements['pred_password']) != 'undefined'
|
||||
&& (the_form.elements['pred_password'].value == 'none'
|
||||
|| the_form.elements['pred_password'].value == 'keep')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Validates
|
||||
if (the_form.elements['pma_pw'].value == '') {
|
||||
alert(jsPasswordEmpty);
|
||||
the_form.elements['pma_pw2'].value = '';
|
||||
the_form.elements['pma_pw'].focus();
|
||||
var password = the_form.elements['pma_pw'];
|
||||
var password_repeat = the_form.elements['pma_pw2'];
|
||||
var alert_msg = false;
|
||||
|
||||
if (password.value == '') {
|
||||
alert_msg = jsPasswordEmpty;
|
||||
} else if (password.value != password_repeat.value) {
|
||||
alert_msg = jsPasswordNotSame;
|
||||
}
|
||||
|
||||
if (alert_msg) {
|
||||
alert(alert_msg);
|
||||
password.value = '';
|
||||
password_repeat.value = '';
|
||||
password.focus();
|
||||
return false;
|
||||
} else if (the_form.elements['pma_pw'].value != the_form.elements['pma_pw2'].value) {
|
||||
alert(jsPasswordNotSame);
|
||||
the_form.elements['pma_pw'].value = '';
|
||||
the_form.elements['pma_pw2'].value = '';
|
||||
the_form.elements['pma_pw'].focus();
|
||||
return false;
|
||||
} // end if...else if
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'checkPassword()' function
|
||||
|
Reference in New Issue
Block a user