Skip to content

fix: case-insensitive email lookup for authentication#584

Open
nora-weisser wants to merge 3 commits intomainfrom
feature/login-endpoint-fix
Open

fix: case-insensitive email lookup for authentication#584
nora-weisser wants to merge 3 commits intomainfrom
feature/login-endpoint-fix

Conversation

@nora-weisser
Copy link
Copy Markdown
Contributor

Problem

Login was case-sensitive — admin@wcc.dev and Admin@wcc.dev were treated as different accounts, causing 401 for users who registered or were seeded with a different email casing than what they typed at login.

Change Type

  • Bug Fix

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
platform-admin Ignored Ignored Mar 25, 2026 8:42pm

private static final String SQL_SELECT_BY_ID = "SELECT * FROM user_accounts WHERE id = ?";
private static final String SQL_SELECT_BY_MAIL = "SELECT * FROM user_accounts WHERE email = ?";
private static final String SQL_SELECT_BY_MAIL =
"SELECT * FROM user_accounts WHERE LOWER(email) = LOWER(?)";
Copy link
Copy Markdown
Collaborator

@dricazenck dricazenck Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this complexity to the database, but should be in the service to always ignore-case to compare emails. Probably we can add before save member data.

MemberMapper.addMember#
...
var email= member.getEmail().toLowerCase(Locale.ENGLISH);
final var existingMemberId = findMemberIdByEmail(email);

jdbc.update(
        INSERT,
        member.getFullName(),
        member.getSlackDisplayName(),
        member.getPosition(),
        member.getCompanyName(),
        email,
        member.getCity(),
        getCountryId(member.getCountry()),
        defaultStatusPending,
        member.getPronouns(),
        getPronounCategoryId(member.getPronounCategory()),
        member.getIsWomen());
        

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made these changes, could you please take a look? Thanks!

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants