fix: normalise email to lowercase and prevent duplicate accounts - #609
Open
0x5t4l1n wants to merge 1 commit into
Open
fix: normalise email to lowercase and prevent duplicate accounts#6090x5t4l1n wants to merge 1 commit into
0x5t4l1n wants to merge 1 commit into
Conversation
Resolves compserv#500. Account creation was case-sensitive: User@Berkeley.EDU and user@berkeley.edu would both pass validation and create two separate accounts. Fix by lowercasing the email in clean_email() before the domain check, and raising ValidationError when an account with that address (case-insensitive) already exists.
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.
Summary\n\nFixes #500 — account creation was case-sensitive, allowing
User@Berkeley.EDUanduser@berkeley.eduto create two separate accounts.\n\nChanges inhknweb/forms.py:\n- Lowercase the email inclean_email()before the domain check\n- RaiseValidationErrorwith codeduplicatewhen an account with that address already exists\n\n## Test plan\n- [ ] Register withTest@Berkeley.EDU— should succeed\n- [ ] Register again withtest@berkeley.edu— should show duplicate error\n- [ ] Register withTEST@BERKELEY.EDU— same duplicate error\n\n🤖 Generated with Claude Code