Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support case-insensitive username logins #14585

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

shane-tang
Copy link

@shane-tang shane-tang commented Apr 13, 2023

Fixes #14586. See issue for more product details.


Changes

Previously, the login controller was searching the DB for a record with an exact case-sensitive username match (returning either a Document or undefined).

This PR makes the login controller search the DB for all records with a case-insensitive username match (returning a Document[]). If the resulting array's size is 0, user = undefined. If the size is 1, user = result[0]. If the size is 2+, we search the resulting Document[] for an exact case-sensitive username match, returning either a Document or undefined.


Demo

Login w/out Username Collisions Login w/ Username Collisions
case-insensitive-login username-collision-login
Click the header link for a full video of creating the users if you want a fuller picture

Disclaimer

I've manually tested that users with colliding usernames still log with the same case-sensitive behavior by removing the unique username constraint on my local instance's registration controller (demonstrated in this video), but I don't believe it's possible to add this case to the integration tests because we can't/shouldn't lift that constraint on the actual registration controller.


UUID: 99f20106-7060-4398-b565-26e56c4de2ad

@CuriousMagpie
Copy link
Member

@SabreCat This works as intended, however I'm unclear if the (case-sensitive) wording should be removed from the login page or if we want to keep it for the rare folks who have the same username but in different cases Bob vs BOB for instance.

@SabreCat
Copy link
Member

Hmm, it's probably ok leaving it, but we can check with the rest of the team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usernames should not be case-sensitive when logging in
3 participants