Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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)
  • Loading branch information...
commit 808a3baaf84781c089c9da229a78ba10f1a425fd 1 parent 6dd38d4
moodler authored
Showing with 16 additions and 3 deletions.
  1. +10 −1 lib/moodlelib.php
  2. +6 −2 login/index.php
View
11 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
View
8 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);
Please sign in to comment.
Something went wrong with that request. Please try again.