From: skodak Date: Wed, 24 May 2006 20:56:16 +0000 (+0000) Subject: Bug #5587 - Redirect fails after a failed login and proper variable initialisation... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3e5c847420ee679587f487f4e7c6ba6cade64dcb;p=moodle.git Bug #5587 - Redirect fails after a failed login and proper variable initialisation; merged from MOODLE_16_STABLE --- diff --git a/login/index.php b/login/index.php index 6ba0ab2cf1..a0c25d5589 100644 --- a/login/index.php +++ b/login/index.php @@ -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; @@ -216,7 +219,9 @@ 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; } @@ -227,10 +232,6 @@ /// Generate the login page with forms - if (empty($errormsg)) { - $errormsg = ''; - } - if ($session_has_timed_out) { $errormsg = get_string('sessionerroruser', 'error'); }