Don't destroy the session if logins are still present. fixes #12301

If you are logged-in into multiple database servers, logOut() logs you
out of all of them. This fix will prevent that, and will only destroy
the session when you log out of the last server.

Signed-off-by: Michal Čihař <michal@cihar.com>
Signed-off-by: Harro Verton <wanwizard@wanwizard.eu>
This commit is contained in:
Harro Verton 2017-04-28 11:09:59 +01:00 committed by Michal Čihař
parent 6e27bc61ef
commit cde775bd2b

View File

@ -74,9 +74,17 @@ abstract class AuthenticationPlugin
$PHP_AUTH_USER = '';
$PHP_AUTH_PW = '';
/* Get a logged-in server count */
$servers = 0;
foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
if (isset($_COOKIE['pmaAuth-' . $key])) {
$servers++;
}
}
/* delete user's choices that were stored in session */
$_SESSION = array();
if (!defined('TESTSUITE')) {
if ($servers === 0 and ! defined('TESTSUITE')) {
$_SESSION = array();
session_destroy();
}