phpmyadmin/libraries/classes/Controllers/LogoutController.php
Maurício Meneghini Fauth a520e235eb
Move Core::sendHeaderLocation() to ResponseRenderer::redirect()
Removes the IIS specific logic.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-08-06 17:43:42 -03:00

29 lines
653 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Plugins\AuthenticationPluginFactory;
use PhpMyAdmin\ResponseRenderer;
class LogoutController
{
public function __construct(private AuthenticationPluginFactory $authPluginFactory)
{
}
public function __invoke(ServerRequest $request): void
{
if (! $request->isPost() || $GLOBALS['token_mismatch']) {
ResponseRenderer::getInstance()->redirect('./index.php?route=/');
return;
}
$authPlugin = $this->authPluginFactory->create();
$authPlugin->logOut();
}
}