bugfix : fix user_entry validation control (#1871)

* fix user_entry control

* code optimsation

* poetry syntaxe requirement

* poetry is really strict with python

* resolve linting error

* Update security.py

* fix user_entry = [()]

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
tomamplius 2023-01-01 21:52:49 +01:00 committed by GitHub
parent a71067e3ec
commit 25ebe2d6fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,7 @@ def user_from_ldap(db: AllRepositories, username: str, password: str) -> Private
f"(&(objectClass=user)(|(cn={username})(sAMAccountName={username})(mail={username})))",
["name", "mail"],
)
if not user_entry:
if user_entry is not None and len(user_entry[0]) != 0 and user_entry[0][0] is not None:
user_dn, user_attr = user_entry[0]
else:
return False