From 9698bf15b9de16eeb66df10abe8cf4458f1a2fa5 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 3 Apr 2004 04:55:35 +0000 Subject: [PATCH] Some changes to make login a little more robust on some sites that have multiple addresses --- login/index.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/login/index.php b/login/index.php index 2584b68f909..91150dd08f1 100644 --- a/login/index.php +++ b/login/index.php @@ -65,19 +65,20 @@ set_moodle_cookie($USER->username); + $wantsurl = $SESSION->wantsurl; + + unset($SESSION->wantsurl); unset($SESSION->lang); if (user_not_fully_set_up($USER)) { $site = get_site(); redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id"); - } else if (empty($SESSION->wantsurl)) { - redirect("$CFG->wwwroot/"); + } else if (strpos($wantsurl, $CFG->wwwroot) === 0) { /// Matches site address + redirect($wantsurl); } else { - $wantsurl = $SESSION->wantsurl; - unset($SESSION->wantsurl); - redirect($wantsurl); + redirect("$CFG->wwwroot/"); /// Go to the standard home page } reset_login_count();