Commit c87b0e0a authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Do not show an error if the auth backend is unreachable

parent aba36e27
......@@ -58,8 +58,11 @@ class LdapManager:
self.obsolete = obsolete
def authenticate(self, username, password):
connection = ldap3.Connection(self.server, self.user_dn.format(username), password)
return connection.bind()
try:
connection = ldap3.Connection(self.server, self.user_dn.format(username), password)
return connection.bind()
except ldap3.core.exceptions.LDAPSocketOpenError:
return False
def groups(self, username, password=None):
connection = ldap3.Connection(self.server)
......@@ -100,7 +103,10 @@ class ADManager:
return ldap3.Connection(self.server)
def authenticate(self, username, password):
return self.prepare_connection(username, password).bind()
try:
return self.prepare_connection(username, password).bind()
except ldap3.core.exceptions.LDAPSocketOpenError:
return False
def groups(self, username, password):
connection = self.prepare_connection(username, password)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment