Index: /main/waeup.cas/trunk/waeup/cas/authenticators.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/authenticators.py	(revision 10521)
+++ /main/waeup.cas/trunk/waeup/cas/authenticators.py	(revision 10522)
@@ -193,4 +193,7 @@
             # Usernames in Moodle must not contain uppercase
             # letters even if extendedusernamechars is set True.
+            # Usernames in Moodle are case insensitive.
+            # In other words, Moodle changes usernames from
+            # uppercase to lowercase when you login.
             result = moodle.core_user_create_users([
                 {'username':username.lower(),
@@ -237,10 +240,13 @@
             if principal is None:
                 principal = proxy.check_student_credentials(username, password)
-            if principal is not None:
-                if principal['type'] == 'student':
-                    userdata = proxy.get_student_moodle_data(username)
-                    return self._create_user(username, userdata, moodle)
-                if principal['type'] == 'applicant':
-                    userdata = proxy.get_applicant_moodle_data(username)
-                    return self._create_user(username, userdata, moodle)
-        return (False, 'Invalid username or password or user not eligible.')
+            if principal is None:
+                return (False, 'Invalid username or password')
+            if principal['type'] == 'student':
+                userdata = proxy.get_student_moodle_data(username)
+                return self._create_user(username, userdata, moodle)
+            if principal['type'] == 'applicant':
+                userdata = proxy.get_applicant_moodle_data(username)
+                return self._create_user(username, userdata, moodle)
+            return (False, 'User not eligible')
+        return (False, 'Invalid username or password')
+
Index: /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10521)
+++ /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10522)
@@ -190,4 +190,6 @@
         if username == 'fault5' and password == 'biz':
             return {'type': 'applicant'}
+        if username == 'fault6' and password == 'biz':
+            return {'type': 'boss'}
         return None
 
@@ -351,9 +353,9 @@
         assert result1a == (True, '')
         result2s = auth.check_credentials('SCHOOL1-foo', 'bar')
-        assert result2s == (
-            False, 'Invalid username or password or user not eligible.')
+        assert result2s == (False, 'Invalid username or password')
         result3s = auth.check_credentials('SCHOOL2-bar', 'baz')
-        assert result3s == (
-            False, 'Invalid username or password or user not eligible.')
+        assert result3s == (False, 'Invalid username or password')
+        result8 = auth.check_credentials('SCHOOL1-fault6', 'biz')
+        assert result8 == (False, 'User not eligible')
 
         # exceptions are raised in the follwoing cases
