-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Make Username and Email Case-Insensitive #586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, all discussions resolved
Backend/Controllers/UserController.cs, line 40 at r2 (raw file):
public async Task<IActionResult> ResetPasswordRequest([FromBody] PasswordResetData data) { var email = data.Email.ToLower();
I recommend using ToLowerInvariant()
There are some weird edge cases where the result could depend on the localization language.
We aren't localizing the backend yet, but we will need to in the future in order to get translations of the invitation e-mails.
Backend/Controllers/UserController.cs, line 40 at r2 (raw file): Previously, jasonleenaylor (Jason Naylor) wrote…
Gotcha, I've switched em. |
Backend/Controllers/UserController.cs, line 40 at r3 (raw file):
In the backend unit tests, This means we aren't currently testing that lower casing is being applied in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnthagen)
Backend/Controllers/UserController.cs, line 40 at r3 (raw file):
Previously, johnthagen wrote…
In the backend unit tests,
Util.RandString()
is used to create user names. The implementation of that only uses the charactersa
throughz
(lower case).This means we aren't currently testing that lower casing is being applied in the
UserController
. Could the unit tests be updated to test that lower-casing is being applied?
We'll address this unit test in a follow up PR.
Backend/Controllers/UserController.cs, line 40 at r3 (raw file): Previously, jasonleenaylor (Jason Naylor) wrote…
Currently working on tests right now |
Backend/Controllers/UserController.cs, line 40 at r3 (raw file): Previously, StevesBro wrote…
Created separate follow on ticket per Jason's comment: #628 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4.
Reviewable status: complete! all files reviewed, all discussions resolved
@StevesBro @jmgrady @imnasnainaec Does this PR require a DB fix up? Users with capital letters in their user name or password saved in the database before this PR wouldn't be able to log in right? If they had a username Edit: maybe not, it looks like we are lowering from the database too: var userList = await _userDatabase.Users.FindAsync(x =>
x.Username.ToLowerInvariant() == username.ToLowerInvariant()); I guess the only risk might be if two users had been using similar names ( |
I make username and email ToLower whenever it is sent to a controller.
This change is