Repository navigation
Trim the identifier in user repository lookups (#574) - #578
Merged
Merged
Conversation
…till signs in and finds the user (#574)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
============================================
+ Coverage 97.04% 97.05% +0.01%
Complexity 5302 5302
============================================
Files 433 433
Lines 13724 13724
============================================
+ Hits 13318 13320 +2
+ Misses 406 404 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #574.
UserRepositorylower-cased identifiers but did not trim them, so a trailing space from a mobile keyboard failed sign-in ("user "→ 401) and made password reset and resend verification a 404.loadUserByIdentifier()(and soloadUserByUsername(), json_login, password reset, resend verification and new email resend),findOneByEmail(),findOneWithPasswordResetToken()andfindOneByUsernameAndNewEmailAddress()(both arguments) now comparestrtolower(trim(...)).FindUserByUsernameTraitcompares the returned username with the trimmed query, otherwise a trimmed match would be refused there (verify email, change password, new email address,UserPassword).Tests:
"user "," USER"and"user@example.com "(SecurityTest), password reset request and resend verification withmy_username%20.UserRepositoryTest(each lookup on an in-memory database) andFindUserByUsernameTraitTest.🤖 Generated with Claude Code