From b363023ee59a391f794567c7e52decaa4a509df9 Mon Sep 17 00:00:00 2001 From: IanM Date: Thu, 4 Jan 2024 20:51:21 +0000 Subject: [PATCH] use clearer config key --- .../core/src/Forum/Controller/LogOutController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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') ?? [] ); } }