authentications fix
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user