Merge branch 'MDL-54921-master' of https://github.com/xow/moodle

This commit is contained in:
Andrew Nicols 2016-12-05 15:13:47 +08:00
commit 8e9cb9b1dd

View File

@ -44,8 +44,16 @@ $PAGE->https_required();
$PAGE->set_url('/login/signup.php');
$PAGE->set_context(context_system::instance());
// Override wanted URL, we do not want to end up here again if user clicks "Login".
$SESSION->wantsurl = $CFG->wwwroot . '/';
// If wantsurl is empty or /login/signup.php, override wanted URL.
// We do not want to end up here again if user clicks "Login".
if (empty($SESSION->wantsurl)) {
$SESSION->wantsurl = $CFG->wwwroot . '/';
} else {
$wantsurl = new moodle_url($SESSION->wantsurl);
if ($PAGE->url->compare($wantsurl, URL_MATCH_BASE)) {
$SESSION->wantsurl = $CFG->wwwroot . '/';
}
}
if (isloggedin() and !isguestuser()) {
// Prevent signing up when already logged in.