Skip to content

Commit

Permalink
cast url as string, reinstate guest redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jan 4, 2024
1 parent b363023 commit af0c032
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions framework/core/src/Forum/Controller/LogOutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public function handle(Request $request): ResponseInterface
$actor = RequestUtil::getActor($request);
$base = $this->url->to('forum')->base();

$url = Arr::get($request->getQueryParams(), 'return', $base);
$sanitizedUrl = $this->sanitizeReturnUrl((string) Arr::get($request->getQueryParams(), 'return', $base));

// If there is no user logged in, return to the index.
if ($actor->isGuest()) {
return new RedirectResponse($base);
return new RedirectResponse(empty($sanitizedUrl) ? $base : $sanitizedUrl);
}

// If a valid CSRF token hasn't been provided, show a view which will
Expand All @@ -113,7 +113,7 @@ public function handle(Request $request): ResponseInterface
}

$accessToken = $session->get('access_token');
$response = new RedirectResponse($url);
$response = new RedirectResponse($sanitizedUrl);

$this->authenticator->logOut($session);

Expand Down

0 comments on commit af0c032

Please sign in to comment.