From c0b04a44346c3417036cf5c46f8b6d19e96426d8 Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Tue, 14 Feb 2023 15:08:20 +0100 Subject: [PATCH] Replaced all the setHeader() with the new setLocation(). This should solve all the downstream bugs on nginx. --- view/view.html.authentication.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/view/view.html.authentication.php b/view/view.html.authentication.php index 966bbd3..1c9b53d 100755 --- a/view/view.html.authentication.php +++ b/view/view.html.authentication.php @@ -89,7 +89,7 @@ class AuthenticationHtmlView extends WebView $location = $this->input->get("location"); $redirect = is_null($location) ? "/" : $location; if ($this->controller->session->user->id !== "0") - $this->output->setHeader("Location: " . $redirect); + $this->output->setLocation($redirect); // Prepare form $form = $this->forms->getCachedForm(function (Form $form) { @@ -139,7 +139,7 @@ class AuthenticationHtmlView extends WebView $this->controller->login($form->identifier->getValue(), $form->password->getValue(), $form->remember->getValue(), $context); // And redirect the user - $this->output->setHeader("Location: " . $redirect); + $this->output->setLocation($redirect); } catch (LoginErrorException $e) { $form->invalidate(true); $form->addFormError($e->getMessage()); @@ -159,17 +159,17 @@ class AuthenticationHtmlView extends WebView $this->controller->logout(); $location = $this->input->get("location"); $redirect = is_null($location) ? "/" : $location; - $this->output->setHeader("Location: " . $redirect); + $this->output->setLocation($redirect); } public function register() { // First check if the registration is enabled if (!$this->plugin->getConfig()->get("register_enabled")) - $this->output->setHeader("Location: /"); + $this->output->setLocation("/"); if ($this->controller->session->user->id !== "0") - $this->output->setHeader("Location: /"); + $this->output->setLocation("/"); // Prepare form $form = $this->forms->getCachedForm(function (Form $form) { @@ -249,7 +249,7 @@ class AuthenticationHtmlView extends WebView // If the token is empty, report so if (empty($token)) - $this->output->setHeader("Location: /"); + $this->output->setLocation("/"); // Generate basic form $form = new Form("ResendVerifyEmailForm", "Resend verification email"); @@ -294,10 +294,10 @@ class AuthenticationHtmlView extends WebView if (is_null($user->password)) { $token = $this->controller->createResetToken($user); - $this->output->setHeader("Location: " . $this->plugin->getAuthenticationURL() . "/reset_password?t=" . $token); + $this->output->setLocation($this->plugin->getAuthenticationURL() . "/reset_password?t=" . $token); } else - $this->output->setHeader("Location: " . $this->plugin->getAuthenticationURL()); + $this->output->setLocation($this->plugin->getAuthenticationURL()); return "Token verified"; } @@ -306,11 +306,11 @@ class AuthenticationHtmlView extends WebView { // If user is already logged in, redirect to homepage if ($this->controller->session->user->id !== "0") - $this->output->setHeader("Location: /"); + $this->output->setLocation("/"); // Check if forgot password is disabled if (!$this->plugin->getConfig()->get("forgot_password_enabled")) - $this->output->setHeader("Location: /"); + $this->output->setLocation("/"); // Prepare form $form = $this->forms->getCachedForm(function (Form $form){ @@ -384,7 +384,7 @@ class AuthenticationHtmlView extends WebView // Reset by controller try { $this->controller->resetPassword($token, $password); - $this->output->setHeader("Location: " . $this->plugin->getAuthenticationURL() . "/login"); + $this->output->setLocation($this->plugin->getAuthenticationURL() . "/login"); } catch (LoginErrorException $e) { $form->invalidate(true); $form->addFormError($e->getMessage());