From dd4f38980cc2f74597966864373deaa06f3d08e2 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 28 Sep 2010 14:05:37 +0000 Subject: [PATCH] MDL-24225 fixed https login redirection - credit goes to Andrew Zoltay --- lib/moodlelib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 0bc475418dc..00fe962cc36 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2088,7 +2088,11 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu print_header_simple('', '', build_navigation(array(array('name' => $strloggedinasguest, 'link' => null, 'type' => 'misc')))); if (empty($USER->access['rsw'][$COURSE->context->path])) { // Normal guest - notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php"); + $loginurl = "$CFG->wwwroot/login/index.php"; + if (!empty($CFG->loginhttps)) { + $loginurl = str_replace('http:','https:', $loginurl); + } + notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), $loginurl); } else { notify(get_string('guestsnotallowed', '', format_string($COURSE->fullname))); echo '
'.switchroles_form($COURSE->id).'
';