[auth] Fixed error handling for signon auth method.
The message is now stored in caller session data and properly displayed in example script.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- bug #3305606 [interface] Show all button wraps on privileges page
|
- bug #3305606 [interface] Show all button wraps on privileges page
|
||||||
- bug #3305517 [config] Config for export compression not used
|
- bug #3305517 [config] Config for export compression not used
|
||||||
- bug #3305883 [interface] Table is dropped regardless of confirmation
|
- bug #3305883 [interface] Table is dropped regardless of confirmation
|
||||||
|
- [auth] Fixed error handling for signon auth method.
|
||||||
|
|
||||||
3.4.1.0 (2011-05-20)
|
3.4.1.0 (2011-05-20)
|
||||||
- bug #3301108 [interface] Synchronize and already configured host
|
- bug #3301108 [interface] Synchronize and already configured host
|
||||||
|
@@ -202,18 +202,35 @@ function PMA_auth_set_user()
|
|||||||
*/
|
*/
|
||||||
function PMA_auth_fails()
|
function PMA_auth_fails()
|
||||||
{
|
{
|
||||||
if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
|
/* Session name */
|
||||||
$_SESSION['PMA_single_signon_error_message'] = __('Login without a password is forbidden by configuration (see AllowNoPassword)');
|
$session_name = $GLOBALS['cfg']['Server']['SignonSession'];
|
||||||
} elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
|
|
||||||
$_SESSION['PMA_single_signon_error_message'] = __('Access denied');
|
/* Does session exist? */
|
||||||
} elseif (! empty($GLOBALS['no_activity'])) {
|
if (isset($_COOKIE[$session_name])) {
|
||||||
$_SESSION['PMA_single_signon_error_message'] = sprintf(__('No activity within %s seconds; please log in again'), $GLOBALS['cfg']['LoginCookieValidity']);
|
/* End current session */
|
||||||
} elseif (PMA_DBI_getError()) {
|
$old_session = session_name();
|
||||||
$_SESSION['PMA_single_signon_error_message'] = PMA_sanitize(PMA_DBI_getError());
|
$old_id = session_id();
|
||||||
} elseif (isset($php_errormsg)) {
|
session_write_close();
|
||||||
$_SESSION['PMA_single_signon_error_message'] = $php_errormsg;
|
|
||||||
} else {
|
/* Load single signon session */
|
||||||
$_SESSION['PMA_single_signon_error_message'] = __('Cannot log in to the MySQL server');
|
session_name($session_name);
|
||||||
|
session_id($_COOKIE[$session_name]);
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
/* Set error message */
|
||||||
|
if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = __('Login without a password is forbidden by configuration (see AllowNoPassword)');
|
||||||
|
} elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = __('Access denied');
|
||||||
|
} elseif (! empty($GLOBALS['no_activity'])) {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = sprintf(__('No activity within %s seconds; please log in again'), $GLOBALS['cfg']['LoginCookieValidity']);
|
||||||
|
} elseif (PMA_DBI_getError()) {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = PMA_sanitize(PMA_DBI_getError());
|
||||||
|
} elseif (isset($php_errormsg)) {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = $php_errormsg;
|
||||||
|
} else {
|
||||||
|
$_SESSION['PMA_single_signon_error_message'] = __('Cannot log in to the MySQL server');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PMA_auth();
|
PMA_auth();
|
||||||
} // end of the 'PMA_auth_fails()' function
|
} // end of the 'PMA_auth_fails()' function
|
||||||
|
@@ -11,14 +11,15 @@
|
|||||||
* @subpackage Example
|
* @subpackage Example
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Need to have cookie visible from parent directory */
|
||||||
|
session_set_cookie_params(0, '/', '', 0);
|
||||||
|
/* Create signon session */
|
||||||
|
$session_name = 'SignonSession';
|
||||||
|
session_name($session_name);
|
||||||
|
session_start();
|
||||||
|
|
||||||
/* Was data posted? */
|
/* Was data posted? */
|
||||||
if (isset($_POST['user'])) {
|
if (isset($_POST['user'])) {
|
||||||
/* Need to have cookie visible from parent directory */
|
|
||||||
session_set_cookie_params(0, '/', '', 0);
|
|
||||||
/* Create signon session */
|
|
||||||
$session_name = 'SignonSession';
|
|
||||||
session_name($session_name);
|
|
||||||
session_start();
|
|
||||||
/* Store there credentials */
|
/* Store there credentials */
|
||||||
$_SESSION['PMA_single_signon_user'] = $_POST['user'];
|
$_SESSION['PMA_single_signon_user'] = $_POST['user'];
|
||||||
$_SESSION['PMA_single_signon_password'] = $_POST['password'];
|
$_SESSION['PMA_single_signon_password'] = $_POST['password'];
|
||||||
@@ -47,7 +48,7 @@ if (isset($_POST['user'])) {
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
if (isset($_SESSION['PMA_single_signon_error_message'])) {
|
if (isset($_SESSION['PMA_single_signon_error_message'])) {
|
||||||
echo '<p class="error">' . $_SESSION['PMA_single_signon_message'] . '</p>';
|
echo '<p class="error">' . $_SESSION['PMA_single_signon_error_message'] . '</p>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form action="signon.php" method="post">
|
<form action="signon.php" method="post">
|
||||||
|
Reference in New Issue
Block a user