Skip to content

feat: 2fa authentication integration#69

Merged
alvarobernal2412 merged 4 commits into
mainfrom
feat/2fa-implement
Jul 24, 2025
Merged

feat: 2fa authentication integration#69
alvarobernal2412 merged 4 commits into
mainfrom
feat/2fa-implement

Conversation

@idavid80
Copy link
Copy Markdown
Collaborator

Frontend: Two-Factor Authentication (2FA) Integration

Aadds full frontend support for enabling, disabling, and verifying Two-Factor Authentication (2FA) using TOTP (Time-based One-Time Passwords). Users can now manage their 2FA settings and complete login flows with an extra verification step when 2FA is enabled.


Login Flow Enhancement

  • LoginForm dynamically switches to Verify2FAForm when 2FA is required.
  • If a user has 2FA enabled, the system requests a TOTP token after the initial login attempt.
  • Includes user feedback and graceful handling of invalid or missing TOTP codes.

2FA Settings Page

  • TwoFADetails component allows users to:
    • View current 2FA status
    • Enable 2FA via QR code
    • Disable 2FA by confirming password and TOTP
  • QR code is rendered on the frontend using the backend-generated image.

Dialog Components

  • Enable2FADialog: Displays a QR code for 2FA setup and captures the user's TOTP token for verification.
  • Disable2FADialog: Prompts for the user’s password and current TOTP code to securely disable 2FA.

UI Components Used

  • Buttons and Cards from @/components/ui
  • Forms using react-hook-form, zod schema validation
  • Notifications with sonner
  • Routing handled by react-router-dom

Behavior Summary

  • User can enable 2FA from their settings page
  • QR code displayed for easy scanning via authenticator apps
  • User can disable 2FA with credentials and a valid token
  • Secure login flow requiring second factor when enabled
  • Cancel option provided during the 2FA login step

Next Steps / Notes

  • Styling and UX enhancements may follow based on feedback
  • Integration with backend error messages is handled gracefully
  • Admin panel support for 2FA could be added in a future iteration

@idavid80 idavid80 self-assigned this Jul 23, 2025
@github-actions github-actions Bot added the 😖 size/l Pull request size L label Jul 23, 2025
@alvarobernal2412 alvarobernal2412 merged commit c707742 into main Jul 24, 2025
3 checks passed
@alvarobernal2412 alvarobernal2412 deleted the feat/2fa-implement branch July 24, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

😖 size/l Pull request size L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants