]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9053 - detect + fix broken $CFG->auth setting from the login page; merged from...
authorskodak <skodak>
Mon, 26 Mar 2007 19:00:21 +0000 (19:00 +0000)
committerskodak <skodak>
Mon, 26 Mar 2007 19:00:21 +0000 (19:00 +0000)
login/index.php

index 43eebe1f3e4b78c8c0a7cc99c6d5bf5b9add0605..03068a6c9d689e8f2597de7d20745b60b3a3d75b 100644 (file)
@@ -44,7 +44,7 @@
 /// Load alternative login screens if necessary
 
 
-$authsequence = explode(',', $CFG->auth); // auths, in sequence
+$cfgauthsequence = explode(',', $CFG->auth); // auths, in sequence
 
 if (!isset($CFG->registerauth)) {
     set_config('registerauth', '');
@@ -55,11 +55,28 @@ if (!isset($CFG->auth_instructions)) {
 }
 
 
-// auth plugins can override these - SSO anyone?
+$authsequence = array();
+$fixauthseq = false;
+
+// fix auth sequence if needed to prevent fatal errors during login
+foreach($cfgauthsequence as $authname) {
+    if (exists_auth_plugin($authname)) {
+        $authsequence[] = $authname;
+        continue;
+    } else {
+        $fixauthseq = true;
+    }
+}
+if ($fixauthseq) {
+    set_config('auth', implode(',', $authsequence));
+}
+
+// auth plugins may override these - SSO anyone?
 $frm  = false;
 $user = false;
 
 foreach($authsequence as $authname) {
+    // manual and auth is not processed here
     $authplugin = get_auth_plugin($authname);
     $authplugin->prelogin_hook();
 }