Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

feat: auth-flow#4

Draft
FirezTheGreat wants to merge 5 commits intoManipal-Open-Source-Learning:mainfrom
FirezTheGreat:feat/auth-flow
Draft

feat: auth-flow#4
FirezTheGreat wants to merge 5 commits intoManipal-Open-Source-Learning:mainfrom
FirezTheGreat:feat/auth-flow

Conversation

@FirezTheGreat
Copy link
Member

@FirezTheGreat FirezTheGreat commented Jul 6, 2025

Please describe the changes this PR makes and why it should be merged:

✅ Unified Auth Flow – Feature Checklist

🔐 Core Logic

  • Create smart unified flow for /register and /login
  • Add Zustand store useUIStore (loading, error, success)
  • Connect error/success states to global toast handler (sonner)
  • Add toast feedback via sonner throughout the flow
  • Redirect known users from /register/login with email autofill
  • Redirect new users from /login/register with email/password preserved

✉️ OTP Verification Flow

  • Add OTP step to flow
  • Implement OTP backend integration (/api/auth/start, /verify)
  • Add expiration time for OTP (e.g. 5 minutes)
  • Rate-limit OTP requests (e.g. 3 per 10 minutes per IP/email)
  • Handle OTP errors (invalid, expired, rate-limited)

👤 Registration Details (New Users)

  • Add password + name steps (multi-step flow)
  • Create database schema for new users in MongoDB
  • Prevent duplicate users after verification
  • Hash password securely on backend
  • Auto-login user and issue JWT after successful registration

🔐 Login Flow (Existing Users)

  • Validate email/password via /api/auth/login
  • On success, issue JWT and set secure cookie
  • Redirect to dashboard after login
  • Handle incorrect credentials via toast

🧠 UI & UX

  • Form validation (email, password strength)
  • Use useAppSeo to dynamically set title/description
  • Smooth transitions between steps

✅ Completion Criteria

  • Full happy-path and edge-case testing
  • New user signup: email → OTP → name + password → onboarding
  • Existing user login: email + password → dashboard
  • Redirect handling between login/register
  • JWT stored securely and user session initialized

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the projects's interface (inbuilt methods or parameters added)
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@FirezTheGreat FirezTheGreat linked an issue Jul 6, 2025 that may be closed by this pull request
@FirezTheGreat FirezTheGreat changed the title Feat/auth flow feat/auth flow Jul 6, 2025
@FirezTheGreat FirezTheGreat added backend Bug related to API / data / server logic feature Request or suggestion for a new feature frontend Bug related to UI / CSS / components labels Jul 6, 2025
@FirezTheGreat FirezTheGreat reopened this Jul 8, 2025
@FirezTheGreat FirezTheGreat changed the title feat/auth flow feat: auth-flow Jul 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backend Bug related to API / data / server logic feature Request or suggestion for a new feature frontend Bug related to UI / CSS / components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Unified Multi-Step Registration Flow at /auth route

2 participants