includes/phpmyadmin/user_details.js
/**
 * Validates the the password field in a form
 *
 * @param   object   the form
 *
 * @return  boolean  whether the field value is valid or not
 */
Validates the the password field in a form

@param   object   the form

@return  boolean  whether the field value is valid or not
Validates the the password field in a form @param object the form @return boolean whether the field value is valid or not
function checkPassword(the_form)
{
    if (the_form.name == 'addUserForm') {
        var pswd_index = 1;
        var pswd1_name = 'pma_pw';
        var pswd2_name = 'pma_pw2';
    } else {
        var pswd_index = 2;
        var pswd1_name = 'new_pw';
        var pswd2_name = 'new_pw2';
    }
    if (the_form.elements['nopass'][pswd_index].checked) {
        if (the_form.elements[pswd1_name].value == '') {
            alert(jsPasswordEmpty);
            the_form.elements[pswd2_name].value = '';
            the_form.elements[pswd1_name].focus();
            return false;
        } else if (the_form.elements[pswd1_name].value != the_form.elements[pswd2_name].value) {
            alert(jsPasswordNotSame);
            the_form.elements[pswd1_name].value  = '';
            the_form.elements[pswd2_name].value = '';
            the_form.elements[pswd1_name].focus();
            return false;
        } 
    } 
    return true;
} 
function checkPassword ( the_form ) { if ( the_form . name == 'addUserForm' ) { var pswd_index = 1 ; var pswd1_name = 'pma_pw' ; var pswd2_name = 'pma_pw2' ; } else { var pswd_index = 2 ; var pswd1_name = 'new_pw' ; var pswd2_name = 'new_pw2' ; } if ( the_form . elements [ 'nopass' ] [ pswd_index ] . checked ) { if ( the_form . elements [ pswd1_name ] . value == '' ) { alert ( jsPasswordEmpty ) ; the_form . elements [ pswd2_name ] . value = '' ; the_form . elements [ pswd1_name ] . focus ( ) ; return false ; } else if ( the_form . elements [ pswd1_name ] . value != the_form . elements [ pswd2_name ] . value ) { alert ( jsPasswordNotSame ) ; the_form . elements [ pswd1_name ] . value = '' ; the_form . elements [ pswd2_name ] . value = '' ; the_form . elements [ pswd1_name ] . focus ( ) ; return false ; } } return true ; }
Validates the the password field in a form
Validates the the password field in a form
// Gets the elements pointers
 // Validates
 // end if...else if
 // end if
 // end of the 'checkPassword()' function
