From: moodler <moodler>
Date: Fri, 28 Jan 2005 16:59:43 +0000 (+0000)
Subject: Fixes notices when username doesn't exist
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=18f16d61ff1ea3bfd42a5761acbcc05131008d25;p=moodle.git

Fixes notices when username doesn't exist
---

diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index cbfa9e2668..5001c8d858 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1740,7 +1740,10 @@ function authenticate_user_login($username, $password) {
 
     // First try to find the user in the database
 
-    $user = get_user_info_from_db('username', $username);
+    if (!$user = get_user_info_from_db('username', $username)) {
+        $user->id = 0;     // Not a user
+        $user->auth = $CFG->auth;
+    }
 
     // Sort out the authentication method we are using.