mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
Properly handle ldap3.abstract.attribute.Attribute value
This commit fixes an issue created on commit 2e7a01f30a
.
Ldap object is type <class 'ldap3.abstract.attribute.Attribute'>.
So we need to return the value and verify if it's null, string or list.
Fixes #12813
This commit is contained in:
parent
8158609c93
commit
c70fedb626
@ -230,7 +230,7 @@ async def ldap_auth(request: Request, response: Response, form_data: LdapForm):
|
|||||||
|
|
||||||
entry = connection_app.entries[0]
|
entry = connection_app.entries[0]
|
||||||
username = str(entry[f"{LDAP_ATTRIBUTE_FOR_USERNAME}"]).lower()
|
username = str(entry[f"{LDAP_ATTRIBUTE_FOR_USERNAME}"]).lower()
|
||||||
email = entry[f"{LDAP_ATTRIBUTE_FOR_MAIL}"]
|
email = entry[f"{LDAP_ATTRIBUTE_FOR_MAIL}"].value # retrive the Attribute value
|
||||||
if not email:
|
if not email:
|
||||||
raise HTTPException(400, "User does not have a valid email address.")
|
raise HTTPException(400, "User does not have a valid email address.")
|
||||||
elif isinstance(email, str):
|
elif isinstance(email, str):
|
||||||
|
Loading…
Reference in New Issue
Block a user