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
|
* Validates the password field in a form
|
||||||
*
|
*
|
||||||
|
* @uses jsPasswordEmpty
|
||||||
|
* @uses jsPasswordNotSame
|
||||||
* @param object the form
|
* @param object the form
|
||||||
*
|
|
||||||
* @return boolean whether the field value is valid or not
|
* @return boolean whether the field value is valid or not
|
||||||
*/
|
*/
|
||||||
function checkPassword(the_form)
|
function checkPassword(the_form)
|
||||||
{
|
{
|
||||||
// Did the user select 'no password'?
|
// 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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validates
|
var password = the_form.elements['pma_pw'];
|
||||||
if (the_form.elements['pma_pw'].value == '') {
|
var password_repeat = the_form.elements['pma_pw2'];
|
||||||
alert(jsPasswordEmpty);
|
var alert_msg = false;
|
||||||
the_form.elements['pma_pw2'].value = '';
|
|
||||||
the_form.elements['pma_pw'].focus();
|
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;
|
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;
|
return true;
|
||||||
} // end of the 'checkPassword()' function
|
} // end of the 'checkPassword()' function
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
||||||
/**
|
|
||||||
* function used for password change form
|
|
||||||
*
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
// Gets the elements pointers
|
|
||||||
// use password radio button
|
|
||||||
var use_pass = the_form.elements['nopass'][1].checked;
|
|
||||||
|
|
||||||
// Validates
|
|
||||||
if (use_pass) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
} // end if (use_pass)
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} // end of the 'checkPassword()' function
|
|
@@ -83,8 +83,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('user_password.js', $GLOBALS['js_include'])
|
if (in_array('server_privileges.js', $GLOBALS['js_include'])) {
|
||||||
|| in_array('server_privileges.js', $GLOBALS['js_include'])) {
|
|
||||||
?>
|
?>
|
||||||
// js form validation stuff
|
// js form validation stuff
|
||||||
var jsHostEmpty = '<?php echo PMA_escapeJsString($GLOBALS['strHostEmpty']); ?>';
|
var jsHostEmpty = '<?php echo PMA_escapeJsString($GLOBALS['strHostEmpty']); ?>';
|
||||||
|
@@ -88,7 +88,7 @@ if (isset($nopass)) {
|
|||||||
* aren't valid -> displays the form
|
* aren't valid -> displays the form
|
||||||
*/
|
*/
|
||||||
// Loads the headers
|
// Loads the headers
|
||||||
$GLOBALS['js_include'][] = 'user_password.js';
|
$GLOBALS['js_include'][] = 'server_privileges.js';
|
||||||
require_once './libraries/header.inc.php';
|
require_once './libraries/header.inc.php';
|
||||||
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
|
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user