fix(hub): case-insensitive email login#1889
Conversation
|
What about a user whose mail is user@gmail.com, when you are saving the mail of another user whose mail is User@gmail.com as user@gmail.com |
By normalizing to lowercase at registration time, two users trying to register user@gmail.com and User@gmail.com will both resolve to user@gmail.com, so the second registration will be rejected as a duplicate. That's exactly the correct behavior. |
Thank you for explaining senior. Really appreciate the help. |
henrygd
left a comment
There was a problem hiding this comment.
Thanks, however I'm worried that converting to lowercase in JS will prevent login if a user's email is already saved with non-lowercase characters.
We would probably need to add a migration that converts all existing emails to lowercase. But this may break oauth logins if the email has non-lowercase on the provider's side.
I found this comment from the PocketBase author that suggests using a collation. Maybe we can add this in a migration.
I'll follow up when I have time to write a few basic tests.
|
Hey @svenvg93 — sorry, I filed #1946 before spotting your PR. Turns out mine takes exactly the |
📃 Description
Normalize email addresses to lowercase during login and registration to prevent case-sensitive authentication failures. Users who registered with mixed-case emails (e.g.,
User@Example.com) could not log in using the lowercase variant (user@example.com).🪵 Changelog
🔧 Fixed