diff --git a/user_password.php b/user_password.php
index 7c2f906e5..2e8947548 100644
--- a/user_password.php
+++ b/user_password.php
@@ -1,10 +1,40 @@
' . $strError . '
' . "\n"
- . ' ' . $strNoRights . '
' . "\n";
+ echo '' . "\n";
+ echo '
' . $GLOBALS['strError'] . '
' . "\n";
+ echo PMA_sanitize($strNoRights);
+ echo '';
require_once './libraries/footer.inc.php';
} // end if
@@ -29,56 +61,59 @@ if ($cfg['Server']['auth_type'] == 'config' || !$cfg['ShowChgPassword']) {
* If the "change password" form has been submitted, checks for valid values
* and submit the query or logout
*/
-if (isset($nopass)) {
+if (isset($_REQUEST['nopass'])) {
// similar logic in server_privileges.php
$error_msg = '';
- if ($nopass == 0 && isset($pma_pw) && isset($pma_pw2)) {
- if ($pma_pw != $pma_pw2) {
- $error_msg = $strPasswordNotSame;
- }
- if (empty($pma_pw) || empty($pma_pw2)) {
- $error_msg = $strPasswordEmpty;
- }
- } // end if
+ if ($_REQUEST['nopass'] == '1') {
+ $password = '';
+ } elseif (empty($_REQUEST['pma_pw']) || empty($_REQUEST['pma_pw2'])) {
+ $error_msg = $strPasswordEmpty;
+ } elseif ($_REQUEST['pma_pw'] != $_REQUEST['pma_pw2']) {
+ $error_msg = $strPasswordNotSame;
+ } else {
+ $password = $_REQUEST['pma_pw'];
+ }
- // here $nopass could be == 1
if (empty($error_msg)) {
// Defines the url to return to in case of error in the sql statement
- $common_url_query = PMA_generate_common_url();
+ $_url_params = array();
- $err_url = 'user_password.php?' . $common_url_query;
- $hashing_function = (!empty($pw_hash) && $pw_hash == 'old' ? 'OLD_' : '')
- . 'PASSWORD';
+ $err_url = 'user_password.php' . PMA_generate_common_url($_url_params);
+ if (PMA_isValid($_REQUEST['pw_hash'], 'identical', 'old')) {
+ $hashing_function = 'OLD_PASSWORD';
+ } else {
+ $hashing_function = 'PASSWORD';
+ }
- $sql_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')');
- $local_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($pma_pw) . '\')');
- $result = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, FALSE, $err_url);
+ $sql_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'***\')');
+ $local_query = 'SET password = ' . (($password == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($password) . '\')');
+ $result = @PMA_DBI_try_query($local_query)
+ or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, false, $err_url);
// Changes password cookie if required
// Duration = till the browser is closed for password (we don't want this to be saved)
if ($cfg['Server']['auth_type'] == 'cookie') {
-
- PMA_setCookie('pmaPass-' . $server, PMA_blowfish_encrypt($pma_pw, $GLOBALS['cfg']['blowfish_secret']));
-
+ PMA_setCookie('pmaPass-' . $server,
+ PMA_blowfish_encrypt($password, $GLOBALS['cfg']['blowfish_secret']));
} // end if
+
// For http auth. mode, the "back" link will also enforce new
// authentication
- $http_logout = ($cfg['Server']['auth_type'] == 'http')
- ? '&old_usr=relog'
- : '';
+ if ($cfg['Server']['auth_type'] == 'http') {
+ $_url_params['old_usr'] = 'relog';
+ }
// Displays the page
require_once './libraries/header.inc.php';
echo '' . $strChangePassword . '
' . "\n\n";
- $show_query = 'y';
- PMA_showMessage($strUpdateProfileMessage);
+ PMA_showMessage($strUpdateProfileMessage, $sql_query);
?>
-
+
' . $strChangePassword . '' . "\n\n";
// Displays an error message if required
if (!empty($error_msg)) {
- echo '' . $strError . ': ' . $error_msg . '
' . "\n";
+ echo '' . "\n";
+ echo '
' . $GLOBALS['strError'] . '
' . "\n";
+ echo PMA_sanitize($error_msg);
+ echo '';
}
require_once './libraries/display_change_password.lib.php';