Commit 739c7714 authored by Robin Sonnabend's avatar Robin Sonnabend

Do not show an error if the auth backend is unreachable

parent 81c1ef9d
......@@ -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