Merge remote-tracking branch 'origin/QA_3_5' into QA_3_5

This commit is contained in:
Michal Čihař 2012-06-03 03:11:29 +02:00
commit caf3bebb14
5 changed files with 72 additions and 45 deletions

View File

@ -10,6 +10,9 @@ phpMyAdmin - ChangeLog
- bug Fix popup message on build SQL of import
- bug #3523499 [core] Make X-WebKit-CSP work better
- replace Highcharts with jqplot for query profiling, zoom search
- bug #3531584 [interface] No form validation in change password dialog
- bug #3531585 [interface] Broken password validation in copy user form
- bug #3531586 [unterface] Add user form prints JSON when user presses enter
3.5.1.0 (2012-05-03)
- bug #3510784 [edit] Limit clause ignored when sort order is remembered

View File

@ -2387,6 +2387,47 @@ $(document).ready(function() {
}) // end $().live()
}) // end $(document).ready() for Create Database
/**
* Validates the password field in a form
*
* @see PMA_messages['strPasswordEmpty']
* @see PMA_messages['strPasswordNotSame']
* @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) {
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')) {
return true;
}
var password = the_form.elements['pma_pw'];
var password_repeat = the_form.elements['pma_pw2'];
var alert_msg = false;
if (password.value == '') {
alert_msg = PMA_messages['strPasswordEmpty'];
} else if (password.value != password_repeat.value) {
alert_msg = PMA_messages['strPasswordNotSame'];
}
if (alert_msg) {
alert(alert_msg);
password.value = '';
password_repeat.value = '';
password.focus();
return false;
}
return true;
} // end of the 'checkPassword()' function
/**
* Attach Ajax event handlers for 'Change Password' on main.php
*/
@ -2419,6 +2460,15 @@ $(document).ready(function() {
})
.append(data);
displayPasswordGenerateButton();
$('#change_password_form').bind('submit', function (e) {
e.preventDefault();
$(this)
.closest('.ui-dialog')
.find('.ui-dialog-buttonpane .ui-button')
.first()
.click();
});
}) // end $.get()
}) // end handler for change password anchor
@ -2436,6 +2486,10 @@ $(document).ready(function() {
*/
var the_form = $("#change_password_form");
if (! checkPassword(the_form[0])) {
return false;
}
/**
* @var this_value String containing the value of the submit button.
* Need to append this for the change password form on Server Privileges

View File

@ -9,48 +9,6 @@
*
*/
/**
* Validates the password field in a form
*
* @see PMA_messages['strPasswordEmpty']
* @see PMA_messages['strPasswordNotSame']
* @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) {
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')) {
return true;
}
var password = the_form.elements['pma_pw'];
var password_repeat = the_form.elements['pma_pw2'];
var alert_msg = false;
if (password.value == '') {
alert_msg = PMA_messages['strPasswordEmpty'];
} else if (password.value != password_repeat.value) {
alert_msg = PMA_messages['strPasswordNotSame'];
}
if (alert_msg) {
alert(alert_msg);
password.value = '';
password_repeat.value = '';
password.focus();
return false;
}
return true;
} // end of the 'checkPassword()' function
/**
* Validates the "add a user" form
*
@ -167,7 +125,6 @@ $(document).ready(function() {
var $form = $(this).find("form[name=usersForm]").last();
if (! checkAddUser($form.get(0))) {
PMA_ajaxShowMessage(PMA_messages['strFormEmpty']);
return false;
}
@ -263,6 +220,15 @@ $(document).ready(function() {
displayPasswordGenerateButton();
PMA_convertFootnotesToTooltips($div);
PMA_ajaxRemoveMessage($msgbox);
$div.find('form[name=usersForm]').bind('submit', function (e) {
e.preventDefault();
$(this)
.closest('.ui-dialog')
.find('.ui-dialog-buttonpane .ui-button')
.first()
.click();
});
}); // end $.get()
});//end of Add New User AJAX event handler
@ -397,6 +363,10 @@ $(document).ready(function() {
/** @lends jQuery */
event.preventDefault();
if ($(this).is('.copyUserForm') && ! checkPassword($(this)[0])) {
return false;
}
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$(this).append('<input type="hidden" name="ajax_request" value="true" />');

View File

@ -19,7 +19,7 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
// Displays the form
?>
<form method="post" id="change_password_form" action="<?php echo $GLOBALS['PMA_PHP_SELF']; ?>" name="chgPassword" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'class="ajax" ' : ''); ?> onsubmit="return checkPassword(this)">
<form method="post" id="change_password_form" action="<?php echo $GLOBALS['PMA_PHP_SELF']; ?>" name="chgPassword" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'class="ajax" ' : ''); ?>>
<?php echo PMA_generate_common_hidden_inputs();
if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
echo '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"

View File

@ -2176,7 +2176,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
if (! isset($dbname) && ! $user_does_not_exists) {
include_once './libraries/display_change_password.lib.php';
echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n"
echo '<form action="server_privileges.php" method="post" class="copyUserForm">' . "\n"
. PMA_generate_common_hidden_inputs('', '')
. '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"