If a user has authenticated via external authentication, then FORCE them

to fill out the user profile form (is they can't do anything else until
this is done)
This commit is contained in:
moodler 2002-12-30 15:30:05 +00:00
parent 6dd38d4656
commit 808a3baaf8
2 changed files with 16 additions and 3 deletions

View File

@ -256,7 +256,6 @@ function require_login($courseid=0) {
global $CFG, $SESSION, $USER, $FULLME, $HTTP_REFERER, $PHPSESSID;
// First check that the user is logged in to the site.
if (! (isset($USER->loggedin) and $USER->confirmed and ($USER->site == $CFG->wwwroot)) ) { // They're not
$SESSION->wantsurl = $FULLME;
$SESSION->fromurl = $HTTP_REFERER;
@ -270,6 +269,13 @@ function require_login($courseid=0) {
}
die;
}
// Check that the user account is properly set up
if (user_not_fully_set_up($USER)) {
$site = get_site();
redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
die;
}
// Next, check if the user can be in a particular course
if ($courseid) {
@ -327,6 +333,9 @@ function update_user_login_times() {
return update_record("user", $user);
}
function user_not_fully_set_up($user) {
return (empty($user->firstname) or empty($user->lastname) or empty($user->email));
}
function update_login_count() {
/// Keeps track of login attempts

View File

@ -52,9 +52,13 @@
set_moodle_cookie($USER->username);
if (empty($SESSION->wantsurl)) {
if (user_not_fully_set_up($USER)) {
$site = get_site();
header("Location: $CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
} else if (empty($SESSION->wantsurl)) {
header("Location: $CFG->wwwroot");
} else {
header("Location: $SESSION->wantsurl");
unset($SESSION->wantsurl);