Previously, the code only handled str and list types for the LDAP email attribute. This caused login failures when the attribute was returned as a different type (e.g., a custom LDAP object).
Old code fails with:
email = entry["mail"]
# email = Attribute("mail", ["user@example.com"]) → not str or list
email.lower() # ❌ Attribute has no .lower()
New code fixes this:
email = entry["mail"].value
if not email:
raise HTTPException(...)
elif isinstance(email, str):
email = email.lower()
elif isinstance(email, list):
email = email[0].lower()
else:
email = str(email).lower() # ✅ Fallback for unknown types
This makes login more robust across different LDAP setups and prevents edge case failures.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/12835
**Author:** [@weisser-dev](https://github.com/weisser-dev)
**Created:** 4/14/2025
**Status:** ✅ Merged
**Merged:** 4/14/2025
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `dev`
---
### 📝 Commits (1)
- [`c749083`](https://github.com/open-webui/open-webui/commit/c7490839352e3f6e605462f79cbac3c09673b56a) Update auths.py
### 📊 Changes
**1 file changed** (+2 additions, -0 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/routers/auths.py` (+2 -0)
</details>
### 📄 Description
Previously, the code only handled str and list types for the LDAP email attribute. This caused login failures when the attribute was returned as a different type (e.g., a custom LDAP object).
Old code fails with:
```
email = entry["mail"]
# email = Attribute("mail", ["user@example.com"]) → not str or list
email.lower() # ❌ Attribute has no .lower()
```
New code fixes this:
```
email = entry["mail"].value
if not email:
raise HTTPException(...)
elif isinstance(email, str):
email = email.lower()
elif isinstance(email, list):
email = email[0].lower()
else:
email = str(email).lower() # ✅ Fallback for unknown types
```
This makes login more robust across different LDAP setups and prevents edge case failures.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/12835
Author: @weisser-dev
Created: 4/14/2025
Status: ✅ Merged
Merged: 4/14/2025
Merged by: @tjbck
Base:
dev← Head:dev📝 Commits (1)
c749083Update auths.py📊 Changes
1 file changed (+2 additions, -0 deletions)
View changed files
📝
backend/open_webui/routers/auths.py(+2 -0)📄 Description
Previously, the code only handled str and list types for the LDAP email attribute. This caused login failures when the attribute was returned as a different type (e.g., a custom LDAP object).
Old code fails with:
New code fixes this:
This makes login more robust across different LDAP setups and prevents edge case failures.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.