From d06b2e0c89b9e7e013d03156de080d87d12b00d6 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Fri, 23 Mar 2012 14:40:35 +0800 Subject: [PATCH] MDL-22510 libraries: Set wantsurl only when $setwantsurltome is set in require_login --- lib/moodlelib.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a285ea10bc8..36c4c760652 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2654,7 +2654,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ if (get_user_preferences('auth_forcepasswordchange') && !session_is_loggedinas()) { $userauth = get_auth_plugin($USER->auth); if ($userauth->can_change_password() and !$preventredirect) { - $SESSION->wantsurl = $FULLME; + if ($setwantsurltome) { + $SESSION->wantsurl = $FULLME; + } if ($changeurl = $userauth->change_password_url()) { //use plugin custom url redirect($changeurl); @@ -2677,7 +2679,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ if ($preventredirect) { throw new require_login_exception('User not fully set-up'); } - $SESSION->wantsurl = $FULLME; + if ($setwantsurltome) { + $SESSION->wantsurl = $FULLME; + } redirect($CFG->wwwroot .'/user/edit.php?id='. $USER->id .'&course='. SITEID); } @@ -2697,13 +2701,17 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ if ($preventredirect) { throw new require_login_exception('Policy not agreed'); } - $SESSION->wantsurl = $FULLME; + if ($setwantsurltome) { + $SESSION->wantsurl = $FULLME; + } redirect($CFG->wwwroot .'/user/policy.php'); } else if (!empty($CFG->sitepolicyguest) and isguestuser()) { if ($preventredirect) { throw new require_login_exception('Policy not agreed'); } - $SESSION->wantsurl = $FULLME; + if ($setwantsurltome) { + $SESSION->wantsurl = $FULLME; + } redirect($CFG->wwwroot .'/user/policy.php'); } } @@ -2855,7 +2863,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ if ($preventredirect) { throw new require_login_exception('Not enrolled'); } - $SESSION->wantsurl = $FULLME; + if ($setwantsurltome) { + $SESSION->wantsurl = $FULLME; + } redirect($CFG->wwwroot .'/enrol/index.php?id='. $course->id); } }