diff --git a/ldap.py b/ldap.py index 039117695e8c264742b85346db3e2537461da9e8..5dafae0f68721789cb89936641b0ea331d4cdbcd 100644 --- a/ldap.py +++ b/ldap.py @@ -9,7 +9,7 @@ if 'LDAP_HOST' in config: user = LDAP_USERRE.sub(r'', user.lower()) try: conn = ldap3.Connection(ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True), 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False) - except ldap3.core.exceptions.LDAPBindError: + except ldap3.core.exceptions.LDAPBindError, ldap3.core.exceptions.LDAPPasswordIsMandatoryError: return {}, [] conn.search("cn=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(cn=%s)"%user, attributes=['memberOf', 'givenName', 'sn']) info = {'uid': user, 'givenName': conn.response[0]['attributes']['givenName'][0], 'sn': conn.response[0]['attributes']['sn'][0]}