phpbb: Make sure PhpbbAuth::check_login always returns a tuple.
[matthijs/projects/wipi.git] / conf / auth / phpbb.py
index 4fc06b9e63fbbfccba20bb8d663fda65bb3edc73..54763b3558731a9db66e165c7583a145a973ea2c 100644 (file)
@@ -207,7 +207,7 @@ class PhpbbAuth(BaseAuth):
         conn = connect(**self.dbconfig)
 
         if not conn:
-            return False
+            return (False, False)
 
         # Get some data. Note that we interpolate the prefix ourselves, since
         # letting the mysql library do it only works with values (it adds ''
@@ -218,12 +218,12 @@ class PhpbbAuth(BaseAuth):
         # case insensitive collaction for the username field, so
         # usernames are checked in case insensitive manner.
         cursor = conn.cursor ()
-        cursor.execute ("SELECT user_password,user_email,username FROM `%susers` WHERE username=%%s" % self.dbconfig['phpbb_prefix'], username)
+        cursor.execute ("SELECT user_password,user_email,username FROM `%susers` WHERE LOWER(username)=LOWER(%%s)" % self.dbconfig['phpbb_prefix'], username)
 
         # No data? No login.
         if (cursor.rowcount == 0):
             conn.close()
-            return False
+            return (False, False)
        
         # Check password
         row = cursor.fetchone()