Skip to content

Commit

Permalink
chore: requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jan 5, 2024
1 parent a1dd387 commit 48b5844
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions framework/core/src/Forum/Controller/LogOutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public function handle(Request $request): ResponseInterface
$actor = RequestUtil::getActor($request);
$base = $this->url->to('forum')->base();

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

// If there is no user logged in, return to the index or the return url if it's set.
if ($actor->isGuest()) {
Expand All @@ -107,7 +107,7 @@ public function handle(Request $request): ResponseInterface

if (Arr::get($request->getQueryParams(), 'token') !== $csrfToken) {
$view = $this->view->make('flarum.forum::log-out')
->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($rurl ? '&return=' . urlencode($return) : ''));
->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($returnUrl ? '&return=' . urlencode($return) : ''));

return new HtmlResponse($view->render());
}
Expand Down Expand Up @@ -136,16 +136,16 @@ protected function sanitizeReturnUrl(string $url, string $base): Uri
return new Uri($base);
}

if (in_array($parsedUrl->getHost(), $this->getWhitelistedRedirectDomains())) {
if (in_array($parsedUrl->getHost(), $this->getAllowedRedirectDomains())) {
return $parsedUrl;
}

return new Uri($base);
}

protected function getWhitelistedRedirectDomains(): array
protected function getAllowedRedirectDomains(): array
{
$forumUri = new Uri($this->config->url());
$forumUri = $this->config->url();

return array_merge(
[$forumUri->getHost()],
Expand Down

0 comments on commit 48b5844

Please sign in to comment.