From 738e1028c61645be050a93083474d88c426e657c Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 16 Nov 2011 15:45:28 +0100 Subject: [PATCH] Added HeaderUtil::delayedRedirect() method --- .../files/lib/acp/form/LoginForm.class.php | 7 ++++--- .../install/files/lib/util/HeaderUtil.class.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php index e8834aecd9..5215806885 100755 --- a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php @@ -95,12 +95,13 @@ class LoginForm extends AbstractForm { $this->user = EmailUserAuthentication::getInstance()->loginManually($this->username, $this->password); } catch (UserInputException $e2) { - if ($e->getField() == 'username') throw $e; + if ($e2->getField() == 'username') throw $e; throw $e2; } } - - throw $e; + else { + throw $e; + } } else { throw $e; diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index 984284ece8..c29bf4c250 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -101,4 +101,21 @@ class HeaderUtil { if ($sendStatusCode) @header('HTTP/1.1 307 Temporary Redirect'); header('Location: '.$location); } + + /** + * Does a delayed redirect. + * + * @param string $location + * @param string $message + * @param integer $delay + */ + public static function delayedRedirect($location, $message, $delay = 5) { + WCF::getTPL()->assign(array( + 'url' => $location, + 'message' => $message, + 'wait' => $delay, + 'templateName' => 'redirect' + )); + WCF::getTPL()->display('redirect'); + } } -- 2.20.1