From 6a1f8bcdffc7db9dd480ac76a28c0acf1b8ef8ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Aug 2021 15:58:09 +0200 Subject: [PATCH] Use PSR-7 responses in FacebookAuthAction --- .../lib/action/FacebookAuthAction.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php index 35bd06f3ed..3d9ede13e3 100644 --- a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php @@ -3,6 +3,7 @@ namespace wcf\action; use GuzzleHttp\Psr7\Request; +use Laminas\Diactoros\Response\RedirectResponse; use wcf\data\user\User; use wcf\form\RegisterForm; use wcf\system\event\EventHandler; @@ -11,7 +12,6 @@ use wcf\system\request\LinkHandler; use wcf\system\user\authentication\event\UserLoggedIn; use wcf\system\user\authentication\oauth\User as OauthUser; use wcf\system\WCF; -use wcf\util\HeaderUtil; use wcf\util\JSON; use wcf\util\StringUtil; @@ -141,9 +141,9 @@ final class FacebookAuthAction extends AbstractOauth2Action new UserLoggedIn($user) ); - HeaderUtil::redirect(LinkHandler::getInstance()->getLink()); - - exit; + return new RedirectResponse( + LinkHandler::getInstance()->getLink() + ); } } else { WCF::getSession()->register('__3rdPartyProvider', 'facebook'); @@ -154,9 +154,9 @@ final class FacebookAuthAction extends AbstractOauth2Action WCF::getSession()->register('__oauthUser', $oauthUser); - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('AccountManagement') . '#3rdParty'); - - exit; + return new RedirectResponse( + LinkHandler::getInstance()->getLink('AccountManagement') . '#3rdParty' + ); } else { // This account does not belong to anyone and we are not logged in. // Thus we want to connect this account to a newly registered user. @@ -170,9 +170,10 @@ final class FacebookAuthAction extends AbstractOauth2Action WCF::getSession()->register('noRegistrationCaptcha', true); WCF::getSession()->update(); - HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(RegisterForm::class)); - exit; + return new RedirectResponse( + LinkHandler::getInstance()->getControllerLink(RegisterForm::class) + ); } } } -- 2.20.1