Skip to content
Snippets Groups Projects
Verified Commit 8f54d50c authored by sistason's avatar sistason
Browse files

when using connect_and_bind_to_ldap directly, handle the LDAPBINDError

also, don't request ldap3.ALL for a simple bind and forget connection
parent 8faa75d5
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,11 @@ def login_get_user(loginname, password): ...@@ -33,9 +33,11 @@ def login_get_user(loginname, password):
else: else:
# When using a LDAP service connection, try bind with separate user connection # When using a LDAP service connection, try bind with separate user connection
if current_app.config['LDAP_SERVICE_BIND_DN']: if current_app.config['LDAP_SERVICE_BIND_DN']:
server = ldap3.Server(current_app.config["LDAP_SERVICE_URL"], get_info=ldap3.ALL) server = ldap3.Server(current_app.config["LDAP_SERVICE_URL"])
try: try:
conn = connect_and_bind_to_ldap(server, dn, password) conn = connect_and_bind_to_ldap(server, dn, password)
if conn is None:
raise LDAPBindError
except (LDAPBindError, LDAPPasswordIsMandatoryError): except (LDAPBindError, LDAPPasswordIsMandatoryError):
return None return None
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment