]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #5587 - Redirect fails after a failed login and proper variable initialisation...
authorskodak <skodak>
Wed, 24 May 2006 20:56:16 +0000 (20:56 +0000)
committerskodak <skodak>
Wed, 24 May 2006 20:56:16 +0000 (20:56 +0000)
login/index.php

index 6ba0ab2cf18df8e2164cb29c0b46dd1dcdda26be..a0c25d5589580c6fe80625e920e766426d3cec68 100644 (file)
@@ -4,6 +4,9 @@
 
     $loginguest = optional_param('loginguest', 0, PARAM_BOOL); // determines whether visitors are logged in as guest automatically
 
+    //initialize variables
+    $errormsg = '';
+
 /// Check for timed out sessions
     if (!empty($SESSION->has_timed_out)) {
         $session_has_timed_out = true;
     if (empty($SESSION->wantsurl)) {
         $SESSION->wantsurl = (array_key_exists('HTTP_REFERER',$_SERVER) && 
                               $_SERVER["HTTP_REFERER"] != $CFG->wwwroot && 
-                              $_SERVER["HTTP_REFERER"] != $CFG->wwwroot.'/')
+                              $_SERVER["HTTP_REFERER"] != $CFG->wwwroot.'/' &&
+                              $_SERVER["HTTP_REFERER"] != $CFG->httpswwwroot.'/login/' &&
+                              $_SERVER["HTTP_REFERER"] != $CFG->httpswwwroot.'/login/index.php')
             ? $_SERVER["HTTP_REFERER"] : NULL;
     }
 
 
 /// Generate the login page with forms
 
-    if (empty($errormsg)) {
-        $errormsg = '';
-    }
-    
     if ($session_has_timed_out) {
         $errormsg = get_string('sessionerroruser', 'error');
     }