MDL-61996 core: when loggedin always check user is complete

This commit is contained in:
Marina Glancy 2018-04-16 15:29:03 +08:00 committed by Jenkins
parent 4864a25baf
commit ce3f804683
2 changed files with 5 additions and 6 deletions

View file

@ -38,7 +38,6 @@ if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && o
$urlparams['redirect'] = 0; $urlparams['redirect'] = 0;
} }
$PAGE->set_url('/', $urlparams); $PAGE->set_url('/', $urlparams);
$PAGE->set_course($SITE);
$PAGE->set_pagelayout('frontpage'); $PAGE->set_pagelayout('frontpage');
$PAGE->set_other_editing_capability('moodle/course:update'); $PAGE->set_other_editing_capability('moodle/course:update');
$PAGE->set_other_editing_capability('moodle/course:manageactivities'); $PAGE->set_other_editing_capability('moodle/course:manageactivities');
@ -47,11 +46,7 @@ $PAGE->set_other_editing_capability('moodle/course:activityvisibility');
// Prevent caching of this page to stop confusion when changing page after making AJAX changes. // Prevent caching of this page to stop confusion when changing page after making AJAX changes.
$PAGE->set_cacheable(false); $PAGE->set_cacheable(false);
if ($CFG->forcelogin) { require_course_login($SITE);
require_login();
} else {
user_accesstime_log();
}
$hasmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance()); $hasmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance());

View file

@ -3005,6 +3005,10 @@ function require_course_login($courseorid, $autologinguest = true, $cm = null, $
// Always login for hidden activities. // Always login for hidden activities.
require_login($courseorid, $autologinguest, $cm, $setwantsurltome, $preventredirect); require_login($courseorid, $autologinguest, $cm, $setwantsurltome, $preventredirect);
} else if (isloggedin() && !isguestuser()) {
// User is already logged in. Make sure the login is complete (user is fully setup, policies agreed).
require_login($courseorid, $autologinguest, $cm, $setwantsurltome, $preventredirect);
} else if ($issite) { } else if ($issite) {
// Login for SITE not required. // Login for SITE not required.
// We still need to instatiate PAGE vars properly so that things that rely on it like navigation function correctly. // We still need to instatiate PAGE vars properly so that things that rely on it like navigation function correctly.