Added HeaderUtil::delayedRedirect() method
authorMarcel Werk <burntime@woltlab.com>
Wed, 16 Nov 2011 14:45:28 +0000 (15:45 +0100)
committerMarcel Werk <burntime@woltlab.com>
Wed, 16 Nov 2011 14:45:28 +0000 (15:45 +0100)
wcfsetup/install/files/lib/acp/form/LoginForm.class.php
wcfsetup/install/files/lib/util/HeaderUtil.class.php

index e8834aecd95434dad89f1ec22e0c76df8d888671..5215806885da76cace5d7b997ea59bd12748f0c8 100755 (executable)
@@ -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;
index 984284ece8be1125e46efec2e3bc9e08a8ce08b7..c29bf4c250a3ada6b71c19f7ebc98a7fc433abcc 100644 (file)
@@ -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');
+       }
 }