Use the router for the logout page

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-08-19 22:47:53 -03:00
parent 3c4447960b
commit 84cb56ab4d
5 changed files with 8 additions and 7 deletions

View File

@ -110,6 +110,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/lint', function () {
require_once ROOT_PATH . 'libraries/entry_points/lint.php';
});
$routes->addRoute(['GET', 'POST'], '/logout', function () {
require_once ROOT_PATH . 'libraries/entry_points/logout.php';
});
$routes->addGroup('/server', function (RouteCollector $routes) {
$routes->addRoute(['GET', 'POST'], '/binlog', function () {
require_once ROOT_PATH . 'libraries/entry_points/server/binlog.php';

View File

@ -2251,7 +2251,7 @@ class DatabaseInterface
$error .= $separator . __('The server is not responding.');
} elseif ($error_number == 1698) {
$error .= ' - ' . $error_message;
$error .= $separator . '<a href="logout.php' . Url::getCommon() . '" class="disableAjax">';
$error .= $separator . '<a href="' . Url::getFromRoute('/logout') . '" class="disableAjax">';
$error .= __('Logout and try as another user.') . '</a>';
} elseif ($error_number == 1005) {
if (strpos($error_message, 'errno: 13') !== false) {

View File

@ -10,14 +10,12 @@ declare(strict_types=1);
use PhpMyAdmin\Core;
use PhpMyAdmin\Plugins\AuthenticationPlugin;
if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
if (! defined('PHPMYADMIN')) {
exit;
}
global $auth_plugin, $token_mismatch;
require_once ROOT_PATH . 'libraries/common.inc.php';
if ($_SERVER['REQUEST_METHOD'] != 'POST' || $token_mismatch) {
Core::sendHeaderLocation('./index.php');
} else {

View File

@ -28,7 +28,7 @@
</a>
{% if server != 0 %}
<a class="logout disableAjax" href="logout.php{{ get_common() }}" title="{{ auth_type == 'config' ? 'Empty session data'|trans : 'Log out'|trans }}">
<a class="logout disableAjax" href="{{ url('/logout') }}" title="{{ auth_type == 'config' ? 'Empty session data'|trans : 'Log out'|trans }}">
{{- get_image('s_loggoff', auth_type == 'config' ? 'Empty session data'|trans : 'Log out'|trans) -}}
</a>
{% endif %}

View File

@ -434,7 +434,7 @@ class DatabaseInterfaceTest extends PmaTestCase
[
1698,
'msg',
'logout.php',
'index.php?route=/logout',
],
[
1005,