Case insensitive email login
Self Checks
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Now email is case sensitive for login. It would be good to make it insensitive as in some companies the formal email address is mixed with upper and lower case but authentication is case insensitive. It is easier to input the formal form on PC but when using mobile devices lower case would be more user friendly.
2. Additional context or comments
No response
3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
Hi @hzywind,
Thank you for your detailed feedback, and for taking the time to submit this issue.
Issue Summary
You reported that login email addresses are currently case-sensitive, which can cause user inconvenience—especially on mobile devices or in environments where email capitalization varies (e.g., [email protected] vs [email protected]). You suggest making the email case-insensitive for authentication, aligning with common practices.
Possible Cause
This behavior typically depends on how emails are stored and compared in the authentication system. If: • Email addresses are stored as-is in the database (with original casing) • And the login comparison is done using a case-sensitive equality (== instead of equalsIgnoreCase() / .lower() etc)
… then even minor differences in casing will prevent successful login.
While the email protocol (RFC 5321) technically allows case sensitivity in the local part (before @), in practice most providers treat emails as case-insensitive, especially for authentication.
Suggested Fix
Here’s how we can resolve this: 1. Normalize emails on both storage and comparison: • Convert all email inputs to lowercase during registration and login. • Ensure the database has a unique index on LOWER(email) if applicable (e.g., PostgreSQL: CREATE UNIQUE INDEX ... ON users (LOWER(email))). • Audit all usages of email lookups to apply .lower() before querying. 2. Backward Compatibility: • If existing data uses mixed-case emails, consider running a migration script to normalize them. • If the system uses external auth providers (e.g., OAuth), ensure the normalization applies to those paths too.
🧪 How to Test • Register with [email protected] • Attempt login with: • [email protected] • [email protected] • [email protected] • All should succeed if implemented correctly.
⸻
📬 Next Steps
If you’re interested in contributing (thank you! 🙌), you could: 1. Let us know your tech stack or which auth system you’re using (e.g., Supabase, Firebase, custom Node/Go/etc). 2. We’ll guide you to the relevant files or modules to modify. 3. We can review your PR once submitted.
Looking forward to your contribution!
Best regards
is this issue closed or can i work on it
@SrigadaAkshayKumar You can work on it if you like :) Check the comments as well https://github.com/langgenius/dify/pull/18826#issuecomment-2833211142
@SrigadaAkshayKumar You can work on it if you like :) Check the comments as well #18826 (comment)
ok