Use PSR-7 responses for redirect in ReauthenticationForm
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 5 Aug 2021 11:43:09 +0000 (13:43 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 5 Aug 2021 11:49:19 +0000 (13:49 +0200)
wcfsetup/install/files/lib/form/ReauthenticationForm.class.php

index 067c3c9457f475f33d2d7ddd012b08b97e8d1bd6..fb2a58e888a619067cc52ac36db4dbc035b2de61 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace wcf\form;
 
+use Laminas\Diactoros\Response\RedirectResponse;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
@@ -52,7 +53,7 @@ class ReauthenticationForm extends AbstractFormBuilderForm
         }
 
         if (!WCF::getSession()->needsReauthentication()) {
-            $this->performRedirect();
+            return $this->getRedirectResponse();
         }
     }
 
@@ -93,11 +94,11 @@ class ReauthenticationForm extends AbstractFormBuilderForm
     {
         AbstractForm::saved();
 
-        $this->performRedirect();
+        $this->setResponse($this->getRedirectResponse());
     }
 
     /**
-     * Returns to the redirectUrl.
+     * @deprecated 5.5 Use `getRedirectResponse()` and the PSR-7 layer instead.
      */
     protected function performRedirect()
     {
@@ -106,6 +107,16 @@ class ReauthenticationForm extends AbstractFormBuilderForm
         exit;
     }
 
+    /**
+     * Returns a RedirectResponse for the redirectUrl.
+     *
+     * @see ReauthenticationForm::$redirectUrl
+     */
+    protected function getRedirectResponse(): RedirectResponse
+    {
+        return new RedirectResponse($this->redirectUrl);
+    }
+
     /**
      * @inheritDoc
      */