Repository navigation
fix: normalize email to lowercase for member, mentor, and user account persistence - #828
Open
kksingh000 wants to merge 3 commits into
Open
kksingh000 wants to merge 3 commits into
kksingh000 wants to merge 3 commits into
Conversation
…t persistence Member, mentor, and user account lookups by email are case-sensitive, but member creation lowercases the email only on insert, not on update. User account creation and update write the email as-is while the lookup used right after lowercases it. A later mixed-case update or account provisioning silently produces a duplicate member row or an account that can never be found again. Normalize to lowercase at every write and read site in MemberMapper, PostgresMemberRepository, PostgresMentorRepository, and PostgresUserAccountRepository so all paths use the same canonical form. Fixes Women-Coding-Community#732
kksingh000
requested review from
OlenaReukova,
Sowmiya07,
Tooonia,
dricazenck,
lauracabtay,
nora-weisser and
nverbic
November 4, 2026 18:06
|
This branch has not been deployed
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.




Description
MemberMapper.addMember()already lowercased the email before insert, butupdateMember()did not. A member who updated their profile with a different casing of their email (e.g.Jane.Doe@Example.cominstead ofjane.doe@example.com) would end up with a mixed-case email stored, while every lookup path (findByEmail,findIdByEmail,deleteByEmail) queried with a case-sensitiveWHERE email = ?against the raw input email, not a lowercased one.This caused two concrete problems:
PostgresUserAccountRepository.create()inserted the raw email and then immediately calledfindByEmail()(which lowercases before querying) to fetch the newly created row. If the email was inserted with mixed case, that lookup would return empty,orElseThrow()would throw, and the transaction would roll back — permanently preventing that user from ever being provisioned or logging in.Fix
Normalize email to lowercase (
Locale.ENGLISH) on every write path, consistent with the read paths that already lowercase before querying:MemberMapper.updateMember()PostgresMemberRepository.findByEmail(),findIdByEmail(),deleteByEmail()PostgresMentorRepository.findByEmail(),findIdByEmail()PostgresUserAccountRepository.create(),update()Notes
No schema change required. PMD is clean (
pmdMain,pmdTest) and the full unit test suite passes locally.Related Issue
Closes #732
Change Type
Screenshots
N/A — backend data-layer fix, no API contract change.
Pull request checklist