From 808a3baaf84781c089c9da229a78ba10f1a425fd Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 30 Dec 2002 15:30:05 +0000 Subject: [PATCH] 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) --- lib/moodlelib.php | 11 ++++++++++- login/index.php | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 9758e458fd..d6127b8443 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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 diff --git a/login/index.php b/login/index.php index 6596236253..bbaf7d4303 100644 --- a/login/index.php +++ b/login/index.php @@ -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); -- 2.39.5