fix failing test

This commit is contained in:
Sergio Brighenti 2023-05-23 22:59:55 +02:00
parent 589720d81b
commit 7a4be04917
2 changed files with 309 additions and 273 deletions

View file

@ -5,6 +5,7 @@ namespace App\Middleware;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler; use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Psr7\Factory\ResponseFactory;
class AuthMiddleware extends Middleware class AuthMiddleware extends Middleware
{ {
@ -19,14 +20,14 @@ class AuthMiddleware extends Middleware
if (!$this->session->get('logged', false)) { if (!$this->session->get('logged', false)) {
$this->session->set('redirectTo', (string) $request->getUri()->getPath()); $this->session->set('redirectTo', (string) $request->getUri()->getPath());
return redirect($this->container->get(ResponseInterface::class), route('login.show')); return redirect((new ResponseFactory())->createResponse(), route('login.show'));
} }
if (!$this->database->query('SELECT `id`, `active` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->active) { if (!$this->database->query('SELECT `id`, `active` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->active) {
$this->session->alert(lang('account_disabled'), 'danger'); $this->session->alert(lang('account_disabled'), 'danger');
$this->session->set('logged', false); $this->session->set('logged', false);
return redirect($this->container->get(ResponseInterface::class), route('login.show')); return redirect((new ResponseFactory())->createResponse(), route('login.show'));
} }
return $handler->handle($request); return $handler->handle($request);

577
composer.lock generated

File diff suppressed because it is too large Load diff