Skip to content

Commit f2cde8e

Browse files
authored
Merge pull request #158 from catalyst/url_issues
Issue #148: Updated manager to $FULLME
2 parents 4fad514 + 4e3745f commit f2cde8e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

classes/manager.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public static function sleep_timer() {
458458
*/
459459
public static function require_auth($courseorid = null, $autologinguest = null, $cm = null,
460460
$setwantsurltome = null, $preventredirect = null) {
461-
global $SESSION, $ME;
461+
global $PAGE, $SESSION, $FULLME;
462462

463463
if (!self::is_ready()) {
464464
// Set session var so if MFA becomes ready, you dont get locked from session.
@@ -467,7 +467,12 @@ public static function require_auth($courseorid = null, $autologinguest = null,
467467
}
468468

469469
if (empty($SESSION->tool_mfa_authenticated) || !$SESSION->tool_mfa_authenticated) {
470-
$cleanurl = new \moodle_url($ME);
470+
if ($PAGE->has_set_url()) {
471+
$cleanurl = $PAGE->url;
472+
} else {
473+
// Use $FULLME instead.
474+
$cleanurl = new \moodle_url($FULLME);
475+
}
471476
$authurl = new \moodle_url('/admin/tool/mfa/auth.php');
472477

473478
$redir = self::should_require_mfa($cleanurl, $preventredirect);

0 commit comments

Comments
 (0)