Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
c87b0e0a
Commit
c87b0e0a
authored
Jun 13, 2017
by
Robin Sonnabend
Browse files
Do not show an error if the auth backend is unreachable
parent
aba36e27
Changes
1
Hide whitespace changes
Inline
Side-by-side
auth.py
View file @
c87b0e0a
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment