From: moodler <moodler>
Date: Thu, 21 Nov 2002 12:39:33 +0000 (+0000)
Subject: Allow admin user to always get in, no matter what the authentication method
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=89b5432563590a7191c0d95c12c55bf94b9e131a;p=moodle.git

Allow admin user to always get in, no matter what the authentication method
---

diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 87b8acaa95..d625052e61 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1450,6 +1450,16 @@ function authenticate_user_login($username, $password) {
             return create_user_record($username, $password);
         }
     }
+
+    // It's possible that the user is the admin user, defined locally.
+    $password = md5($password);
+    if ($user = get_record_sql("SELECT u.id FROM user u, user_admins a 
+                                WHERE u.id = a.user 
+                                  AND u.username = '$username' 
+                                  AND u.password = '$password'")) {
+        return get_user_info_from_db("username", $username);
+    }
+
     return false;
 }