diff --git a/framework/core/src/Forum/Controller/LogOutController.php b/framework/core/src/Forum/Controller/LogOutController.php index c9adcad1d8..fde933fda5 100644 --- a/framework/core/src/Forum/Controller/LogOutController.php +++ b/framework/core/src/Forum/Controller/LogOutController.php @@ -107,7 +107,7 @@ public function handle(Request $request): ResponseInterface $return = $this->sanitizeReturnUrl($request->getQueryParams()['return'] ?? $base); $view = $this->view->make('flarum.forum::log-out') - ->with('url', $this->url->to('forum')->route('logout').'?token='.$csrfToken.($return ? '&return='.urlencode($return) : '')); + ->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($return ? '&return=' . urlencode($return) : '')); return new HtmlResponse($view->render()); } @@ -128,8 +128,8 @@ protected function sanitizeReturnUrl(string $url): string { $parsed = parse_url($url); - if (! $parsed || ! isset($parsed['host'])) { - return ''; + if (!$parsed || !isset($parsed['host'])) { + return ''; // Return early for invalid URLs } $host = $parsed['host']; @@ -138,14 +138,14 @@ protected function sanitizeReturnUrl(string $url): string return $url; } - return ''; + return ''; // Return empty string for non-whitelisted domains } protected function getWhitelistedRedirectDomains(): array { return array_merge( [$this->config->url()], - $this->config->offsetGet('trustedHosts') ?? [] + $this->config->offsetGet('redirectDomains') ?? [] ); } }