authentications fix

This commit is contained in:
2023-03-23 17:49:49 +00:00
parent c69a4469da
commit 478619c1dd

View File

@@ -14,11 +14,16 @@ def authentication(username, password):
if password is None or password.strip() == "": if password is None or password.strip() == "":
return None return None
server = Server(host, port=port, use_ssl=True) server = Server(host, port=port)
userdn = f"uid={username},ou=user,dc=fet,dc=htu,dc=tuwien,dc=ac,dc=at" userdn = f"uid={username},ou=user,dc=fet,dc=htu,dc=tuwien,dc=ac,dc=at"
try: try:
c = Connection(server, user=userdn, password=password, auto_bind=True) c = Connection(server, user=userdn, password=password)
# perform the Bind operation
if not c.bind():
print('error in bind', c.result)
if c.extend.standard.who_am_i(): if c.extend.standard.who_am_i():
return username return username