Changeset 10522 for main/waeup.cas/trunk
- Timestamp:
- 21 Aug 2013, 21:08:11 (11 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/authenticators.py
r10518 r10522 193 193 # Usernames in Moodle must not contain uppercase 194 194 # letters even if extendedusernamechars is set True. 195 # Usernames in Moodle are case insensitive. 196 # In other words, Moodle changes usernames from 197 # uppercase to lowercase when you login. 195 198 result = moodle.core_user_create_users([ 196 199 {'username':username.lower(), … … 237 240 if principal is None: 238 241 principal = proxy.check_student_credentials(username, password) 239 if principal is not None: 240 if principal['type'] == 'student': 241 userdata = proxy.get_student_moodle_data(username) 242 return self._create_user(username, userdata, moodle) 243 if principal['type'] == 'applicant': 244 userdata = proxy.get_applicant_moodle_data(username) 245 return self._create_user(username, userdata, moodle) 246 return (False, 'Invalid username or password or user not eligible.') 242 if principal is None: 243 return (False, 'Invalid username or password') 244 if principal['type'] == 'student': 245 userdata = proxy.get_student_moodle_data(username) 246 return self._create_user(username, userdata, moodle) 247 if principal['type'] == 'applicant': 248 userdata = proxy.get_applicant_moodle_data(username) 249 return self._create_user(username, userdata, moodle) 250 return (False, 'User not eligible') 251 return (False, 'Invalid username or password') 252 -
main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
r10518 r10522 190 190 if username == 'fault5' and password == 'biz': 191 191 return {'type': 'applicant'} 192 if username == 'fault6' and password == 'biz': 193 return {'type': 'boss'} 192 194 return None 193 195 … … 351 353 assert result1a == (True, '') 352 354 result2s = auth.check_credentials('SCHOOL1-foo', 'bar') 353 assert result2s == ( 354 False, 'Invalid username or password or user not eligible.') 355 assert result2s == (False, 'Invalid username or password') 355 356 result3s = auth.check_credentials('SCHOOL2-bar', 'baz') 356 assert result3s == ( 357 False, 'Invalid username or password or user not eligible.') 357 assert result3s == (False, 'Invalid username or password') 358 result8 = auth.check_credentials('SCHOOL1-fault6', 'biz') 359 assert result8 == (False, 'User not eligible') 358 360 359 361 # exceptions are raised in the follwoing cases
Note: See TracChangeset for help on using the changeset viewer.