Skip to content

Commit

Permalink
Update AuthMiddleware.php
Browse files Browse the repository at this point in the history
Keep current key when redirecting to login page.
Related to #309
  • Loading branch information
jbelien committed Apr 13, 2021
1 parent d6e5a98 commit 025cc72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/App/Middleware/AuthMiddlewareHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ public function unauthorizedResponse(ServerRequestInterface $request, RequestHan
return $handler->handle($request);
}

$config = $request->getAttribute(ConfigMiddleware::CONFIG_ATTRIBUTE);

$basePath = $request->getAttribute(BaseUrlMiddleware::BASE_PATH);

$redirect = ($basePath !== '/' ? $basePath : '');
$redirect .= $this->router->generateUri($this->config['redirect']);
$redirect .= '?' . http_build_query(['c' => $config['custom'] ?? null]);

return $this->auth
->unauthorizedResponse($request)
Expand Down

0 comments on commit 025cc72

Please sign in to comment.