From c70fedb6268b6c8e0be1d538e2771787c4b85d18 Mon Sep 17 00:00:00 2001 From: Athanasios Oikonomou Date: Sun, 13 Apr 2025 17:55:50 +0300 Subject: [PATCH] Properly handle ldap3.abstract.attribute.Attribute value This commit fixes an issue created on commit 2e7a01f30adb5e641805f2c37921d111f955f31d. Ldap object is type . So we need to return the value and verify if it's null, string or list. Fixes #12813 --- backend/open_webui/routers/auths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index 6574ef0b1..83d7c4e19 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -230,7 +230,7 @@ async def ldap_auth(request: Request, response: Response, form_data: LdapForm): entry = connection_app.entries[0] 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: raise HTTPException(400, "User does not have a valid email address.") elif isinstance(email, str):