Flagsmith / flagsmith

Open Source Feature Flagging and Remote Config Service. Host on-prem or use our hosted version at https://flagsmith.com/
https://flagsmith.com/
BSD 3-Clause "New" or "Revised" License
4.57k stars 344 forks source link

fix: oauth user case sensitivity #4207

Closed matthewelwell closed 1 week ago

matthewelwell commented 1 week ago

Changes

Resolves https://github.com/Flagsmith/flagsmith/issues/4185.

The main goal of this PR is to ensure that users who authenticate with an OAuth provider after authenticating with email/password, another OAuth provider, or even SAML (although this use case is slim) get a consistent experience. Currently if the email differs by case, a new user will be created and the user will likely be confused as to why they can't see their projects, etc.

As a side effect, we had to handle a few edge cases where a user might already have duplicate accounts and make sure that the user gets the same experience they do today (authenticating with method A gets them into user A, authenticating with user B gets them user B).

We should, separate to this, get in touch with the users for whom this is an issue (~20) and try to merge their accounts.

How did you test this code?

Added 3 new tests to cover all scenarios.

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **docs** | ⬜️ Ignored ([Inspect](https://vercel.com/flagsmith/docs/CE4xNZnnLecXRELMweHnHnMBNCR6)) | [Visit Preview](https://docs-git-fix-oauth-user-case-sensitivity-flagsmith.vercel.app) | | Jun 21, 2024 4:12pm | | **flagsmith-frontend-preview** | ⬜️ Ignored ([Inspect](https://vercel.com/flagsmith/flagsmith-frontend-preview/81P6RuxwKzARc5enrZWWGuLVskUM)) | [Visit Preview](https://flagsmith-frontend-preview-git-fix-oauth-user-5f44b6-flagsmith.vercel.app) | | Jun 21, 2024 4:12pm | | **flagsmith-frontend-staging** | ⬜️ Ignored ([Inspect](https://vercel.com/flagsmith/flagsmith-frontend-staging/85ZVpEfiazDZuDjBu53q3ETLeMda)) | [Visit Preview](https://flagsmith-frontend-staging-git-fix-oauth-user-0b9eba-flagsmith.vercel.app) | | Jun 21, 2024 4:12pm |
github-actions[bot] commented 1 week ago

Uffizzi Preview deployment-53326 was deleted.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.52%. Comparing base (e7fd8bd) to head (b4be67a). Report is 9 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4207 +/- ## ========================================== + Coverage 96.51% 96.52% +0.01% ========================================== Files 1177 1177 Lines 38230 38354 +124 ========================================== + Hits 36896 37023 +127 + Misses 1334 1331 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.