Skip to content

feat(auth): detect existing social accounts during email login to prevent duplicate accounts (#353) - #490

Merged
sshdopey merged 5 commits into
Heliobond:mainfrom
TochukwuJustice:social-account-bug
Aug 28, 2026
Merged

feat(auth): detect existing social accounts during email login to prevent duplicate accounts (#353)#490
sshdopey merged 5 commits into
Heliobond:mainfrom
TochukwuJustice:social-account-bug

Conversation

@TochukwuJustice

Copy link
Copy Markdown
Contributor

closes #353

Summary of Changes

  • Account Provider Detection Utility (src/lib/auth/accountProviderDetection.ts):
    • Implemented normalizeEmail() and detectEmailAuthProvider() to check whether an email address is already linked with a social OAuth provider (e.g. Google, Apple, GitHub).
  • Collision Warning Component (src/components/SocialAccountConflictWarning.tsx):
    • Created an accessible alert banner (role="status") informing the user of their existing social account.
    • Provides a direct one-click CTA ("Sign in with Google") and an optional path for explicit account linking.
  • Email Auth Modal (src/components/EmailAuthModal.tsx, src/components/index.ts):
    • Built an email login modal featuring real-time provider conflict checking, preventing users from inadvertently registering duplicate accounts.
  • Localization (messages/en.json, messages/fr.json):
    • Added matching AccountConflict message strings in English and French, maintaining 100% catalog parity.
  • Unit Tests (src/lib/auth/accountProviderDetection.test.ts, src/components/SocialAccountConflictWarning.test.tsx):
    • Added test coverage for case-insensitive email normalization, provider collision detection, and user interaction callbacks.

Reason for Changes

Resolves #353. Previously, users who originally signed up with a social provider (e.g., Google) and subsequently attempted email-based sign-in with the same address could inadvertently create duplicate accounts or split their portfolio assets. This warning makes the existing authentication method transparent and guides the user to sign in with their existing provider.

…ord reset emails (Heliobond#354)

• Introduce password reset email template generator with relative TTL and absolute UTC deadline formatting
• Add explicit expiration and stale link instructions to HTML and plaintext email templates
• Implement HTML entity escaping and URL protocol sanitization against XSS
• Update English and French localization message catalogs to maintain 100% parity
• Add comprehensive unit tests covering formatting, edge cases, and injection prevention
…ta loss (Heliobond#352)

• Introduce useSessionTimeout hook with throttled user inactivity monitoring and live countdown
• Create accessible SessionTimeoutModal with focus trapping and extend/logout actions
• Integrate SessionWatcher into root Providers to automatically protect connected wallet sessions
• Add SessionTimeout translation keys to English and French message catalogs
• Add unit tests covering inactivity tracking, countdown, extension, and automatic logout
…revent duplicates (Heliobond#353)

• Introduce detectEmailAuthProvider utility for real-time social OAuth provider collision detection
• Create accessible SocialAccountConflictWarning banner with 1-click social sign-in and account linking
• Add EmailAuthModal integrating email validation and social collision detection
• Add AccountConflict translation keys to English and French message catalogs (100% parity)
• Add unit tests covering email normalization, collision detection, and UI warning interaction
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@TochukwuJustice is attempting to deploy a commit to the David Dada's projects Team on Vercel.

A member of the Team first needs to authorize it.

@sshdopey sshdopey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a solid, thoughtful implementation for #353! The account provider detection utility, conflict warning component, and email auth modal directly address the duplicate account issue. I love the accessible alert banner and the clear CTA to sign in with the existing provider. The localization and tests are a great touch. Nice work! 💛

@sshdopey

Copy link
Copy Markdown
Contributor

Approved! 🎉 I couldn't auto-merge this just yet (it may need a rebase or have a check still running). A maintainer can merge it whenever it's ready.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@TochukwuJustice Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sshdopey sshdopey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a thoughtful implementation that directly addresses the duplicate account issue described in #353. The new detection utility, conflict warning component, and email modal work together to guide users toward their existing social provider. I appreciate the included tests and the bilingual message support. Great job! 💖

@sshdopey
sshdopey merged commit 54dfb74 into Heliobond:main Aug 28, 2026
2 of 3 checks passed
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.

bug: Login with email doesn't warn if user enters email from social account — creates duplicate

2 participants