Skip to content

Commit

Permalink
Bug #5587 - Redirect fails after a failed login and proper variable i…
Browse files Browse the repository at this point in the history
…nitialisation; merged from MOODLE_16_STABLE
  • Loading branch information
skodak committed May 24, 2006
1 parent 5e205b7 commit 3e5c847
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -227,10 +232,6 @@

/// Generate the login page with forms

if (empty($errormsg)) {
$errormsg = '';
}

if ($session_has_timed_out) {
$errormsg = get_string('sessionerroruser', 'error');
}
Expand Down

0 comments on commit 3e5c847

Please sign in to comment.