]> git.mjollnir.org Git - moodle.git/commitdiff
If a user has authenticated via external authentication, then FORCE them
authormoodler <moodler>
Mon, 30 Dec 2002 15:30:05 +0000 (15:30 +0000)
committermoodler <moodler>
Mon, 30 Dec 2002 15:30:05 +0000 (15:30 +0000)
to fill out the user profile form (is they can't do anything else until
this is done)

lib/moodlelib.php
login/index.php

index 9758e458fd00c883ed915950d7eff8b21b5c15f6..d6127b84431a8800a60b804ccacbeb7289a36cf6 100644 (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
index 6596236253e8ea3935942b01e68903214670cc09..bbaf7d43030b371456ea08b7225feda0af8edc5f 100644 (file)
 
                    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);