Changeset 10510 for main/waeup.cas/trunk
- Timestamp:
- 20 Aug 2013, 08:08:12 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/authenticators.py
r10509 r10510 2 2 """ 3 3 import re 4 import sys 4 5 from pkg_resources import iter_entry_points 5 6 try: … … 216 217 'email':student['email']}]) 217 218 except xmlrpclib.Fault: 219 faultstring = sys.exc_info()[1].faultString 220 if not 'Username already exists' in faultstring: 221 return (False, faultstring) 218 222 # user exists 219 223 pass 220 result = moodle.core_user_get_users([ 221 {'key':'username', 'value':username}]) 224 try: 225 result = moodle.core_user_get_users([ 226 {'key':'username', 'value':username}]) 227 except xmlrpclib.Fault: 228 faultstring = sys.exc_info()[1].faultString 229 return (False, faultstring) 222 230 user_id = result['users'][0]['id'] 223 231 # Due to a lack of Moodle (Moodle requires an LDAP … … 225 233 # be set when the user is created. It must be updated 226 234 # after creation. 227 result = moodle.core_user_update_users([ 228 {'id':user_id,'auth':'cas'}]) 235 try: 236 result = moodle.core_user_update_users([ 237 {'id':user_id,'auth':'cas'}]) 238 except xmlrpclib.Fault: 239 faultstring = sys.exc_info()[1].faultString 240 return (False, faultstring) 229 241 return (True, '') 230 242 return (False, 'Invalid username or password.')
Note: See TracChangeset for help on using the changeset viewer.