Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-22510 libraries: Set wantsurl only when $setwantsurltome is set in

require_login
  • Loading branch information...
commit 4d8cb115cc9458585f385dff62cb6e0100c4dcb3 1 parent a7899ca
Ankit Agarwal authored

Showing 1 changed file with 15 additions and 5 deletions. Show diff stats Hide diff stats

  1. 20  lib/moodlelib.php
20  lib/moodlelib.php
@@ -2413,7 +2413,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $
2413 2413
     if (get_user_preferences('auth_forcepasswordchange') && !session_is_loggedinas()) {
2414 2414
         $userauth = get_auth_plugin($USER->auth);
2415 2415
         if ($userauth->can_change_password() and !$preventredirect) {
2416  
-            $SESSION->wantsurl = $FULLME;
  2416
+            if ($setwantsurltome) {
  2417
+                $SESSION->wantsurl = $FULLME;
  2418
+            }
2417 2419
             if ($changeurl = $userauth->change_password_url()) {
2418 2420
                 //use plugin custom url
2419 2421
                 redirect($changeurl);
@@ -2436,7 +2438,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $
2436 2438
         if ($preventredirect) {
2437 2439
             throw new require_login_exception('User not fully set-up');
2438 2440
         }
2439  
-        $SESSION->wantsurl = $FULLME;
  2441
+        if ($setwantsurltome) {
  2442
+            $SESSION->wantsurl = $FULLME;
  2443
+        }
2440 2444
         redirect($CFG->wwwroot .'/user/edit.php?id='. $USER->id .'&course='. SITEID);
2441 2445
     }
2442 2446
 
@@ -2456,13 +2460,17 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $
2456 2460
             if ($preventredirect) {
2457 2461
                 throw new require_login_exception('Policy not agreed');
2458 2462
             }
2459  
-            $SESSION->wantsurl = $FULLME;
  2463
+            if ($setwantsurltome) {
  2464
+                $SESSION->wantsurl = $FULLME;
  2465
+            }
2460 2466
             redirect($CFG->wwwroot .'/user/policy.php');
2461 2467
         } else if (!empty($CFG->sitepolicyguest) and isguestuser()) {
2462 2468
             if ($preventredirect) {
2463 2469
                 throw new require_login_exception('Policy not agreed');
2464 2470
             }
2465  
-            $SESSION->wantsurl = $FULLME;
  2471
+            if ($setwantsurltome) {
  2472
+                $SESSION->wantsurl = $FULLME;
  2473
+            }
2466 2474
             redirect($CFG->wwwroot .'/user/policy.php');
2467 2475
         }
2468 2476
     }
@@ -2629,7 +2637,9 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $
2629 2637
             if ($preventredirect) {
2630 2638
                 throw new require_login_exception('Not enrolled');
2631 2639
             }
2632  
-            $SESSION->wantsurl = $FULLME;
  2640
+            if ($setwantsurltome) {
  2641
+                $SESSION->wantsurl = $FULLME;
  2642
+            }
2633 2643
             redirect($CFG->wwwroot .'/enrol/index.php?id='. $course->id);
2634 2644
         }
2635 2645
     }

0 notes on commit 4d8cb11

Please sign in to comment.
Something went wrong with that request. Please try again.