Show More
@@ -205,12 +205,12 def authenticate(username, password): | |||||
205 | log.debug('Got ldap DN response %s', user_dn) |
|
205 | log.debug('Got ldap DN response %s', user_dn) | |
206 |
|
206 | |||
207 | user_attrs = { |
|
207 | user_attrs = { | |
208 |
'name': ldap_attrs |
|
208 | 'name': ldap_attrs.get(ldap_settings\ | |
209 | .get('ldap_attr_firstname')][0], |
|
209 | .get('ldap_attr_firstname'), [''])[0], | |
210 |
'lastname': ldap_attrs |
|
210 | 'lastname': ldap_attrs.get(ldap_settings\ | |
211 | .get('ldap_attr_lastname')][0], |
|
211 | .get('ldap_attr_lastname'),[''])[0], | |
212 |
'email': ldap_attrs |
|
212 | 'email': ldap_attrs.get(ldap_settings\ | |
213 | .get('ldap_attr_email')][0], |
|
213 | .get('ldap_attr_email'), [''])[0], | |
214 | } |
|
214 | } | |
215 |
|
215 | |||
216 | if user_model.create_ldap(username, password, user_dn, |
|
216 | if user_model.create_ldap(username, password, user_dn, |
@@ -105,9 +105,10 class AuthLdap(object): | |||||
105 | if not lobjects: |
|
105 | if not lobjects: | |
106 | raise ldap.NO_SUCH_OBJECT() |
|
106 | raise ldap.NO_SUCH_OBJECT() | |
107 |
|
107 | |||
108 | for (dn, attrs) in lobjects: |
|
108 | for (dn, _attrs) in lobjects: | |
109 | try: |
|
109 | try: | |
110 | server.simple_bind_s(dn, password) |
|
110 | server.simple_bind_s(dn, password) | |
|
111 | attrs = server.search_ext_s(dn, ldap.SCOPE_BASE, '(objectClass=*)')[0][1] | |||
111 | break |
|
112 | break | |
112 |
|
113 | |||
113 | except ldap.INVALID_CREDENTIALS, e: |
|
114 | except ldap.INVALID_CREDENTIALS, e: |
General Comments 0
You need to be logged in to leave comments.
Login now