Skip to content

Latest commit

 

History

History
142 lines (109 loc) · 4.65 KB

File metadata and controls

142 lines (109 loc) · 4.65 KB

Signup Flow Update Summary

Changes Made

1. Signup Flow - No Auto-Login

After signup (both direct registration and LinkedIn OAuth), users are now redirected to the home landing page without being logged in.

Modified Files:

frontend/src/contexts/AuthContext.tsx

  • Updated register function to log out the user immediately after signup
  • Supabase auto-logs in users on signUp(), so we explicitly sign them out
  • Clear all session data and localStorage
  • Show success toast: "Your account has been created successfully!"

frontend/src/app/auth/register/page.tsx

  • Redirect to /?signup=success after successful registration
  • Added 1.5s delay to allow success toast to be visible

frontend/src/app/auth/callback/page.tsx

  • For new OAuth signups, log out the user immediately
  • Redirect to /?signup=success instead of auto-login
  • Existing OAuth users still login normally

frontend/src/app/page.tsx

  • Converted to client component to handle query parameters
  • Detect ?signup=success parameter and show success toast
  • Clean up URL after showing toast

2. Toast Colors Updated

Changed toast notification colors to use dark red for errors and green for success.

frontend/src/components/ui/toast.tsx

  • Success toast: Dark green background (bg-green-600) with white text
  • Error toast: Dark red background (bg-red-900) with white text
  • Improved visibility and contrast

3. Button Text Updates

frontend/src/app/auth/register/page.tsx

  • LinkedIn button now says "LinkedIn" (simplified)

frontend/src/app/auth/pending-approval/page.tsx

  • Removed "Back to Login" button
  • Only "Go to Home" button with black background

How It Works Now

Direct Signup Flow:

  1. User fills registration form
  2. Account created in Supabase
  3. User profile created in database
  4. User immediately logged out (no auto-login)
  5. Redirect to home page with success toast
  6. Success toast shows: "Your account has been created successfully!"

LinkedIn OAuth Signup Flow:

  1. User clicks "LinkedIn" button
  2. Redirected to LinkedIn for authentication
  3. Returns to callback page
  4. New profile created in database
  5. User immediately logged out (no auto-login)
  6. Redirect to home page with success toast
  7. Success toast shows: "Your account has been created successfully!"

LinkedIn OAuth Login Flow (Existing Users):

  1. User clicks "LinkedIn" button
  2. Redirected to LinkedIn for authentication
  3. Returns to callback page
  4. User profile found in database
  5. User logged in successfully
  6. Redirect based on approval status:
    • Pending → /auth/pending-approval
    • Approved → /dashboard
    • Other → / (home)

Toast Notifications

Success Toast (Green):

  • Background: bg-green-600 (dark green)
  • Text: White
  • Border: border-green-700
  • Examples:
    • "Signup successful - Your account has been created successfully!"
    • "Login successful - Welcome back!"

Error Toast (Dark Red):

  • Background: bg-red-900 (dark red)
  • Text: White
  • Border: border-red-700
  • Examples:
    • "Signup error - Email already exists"
    • "Login error - Invalid credentials"

Files Modified

  1. frontend/src/contexts/AuthContext.tsx - Signup logout logic
  2. frontend/src/app/auth/register/page.tsx - Redirect to home after signup
  3. frontend/src/app/auth/callback/page.tsx - OAuth signup logout logic
  4. frontend/src/components/ui/toast.tsx - Dark red and green colors
  5. frontend/src/app/page.tsx - Show signup success toast
  6. frontend/src/app/auth/pending-approval/page.tsx - Button updates

Testing Checklist

  • Direct signup redirects to home (not logged in)
  • Success toast appears after direct signup (green)
  • LinkedIn signup redirects to home (not logged in)
  • Success toast appears after LinkedIn signup (green)
  • LinkedIn login works for existing users
  • Error toasts show in dark red
  • Success toasts show in green
  • URL parameter cleaned after showing toast
  • Pending approval page shows only "Go to Home" button

User Experience

Before:

  • ❌ User auto-logged in after signup
  • ❌ Toast colors were light and hard to read
  • ❌ Multiple buttons on pending page

After:

  • ✅ User NOT logged in after signup (lands on home page)
  • ✅ Clear success message with dark green toast
  • ✅ Clean, simple pending approval page
  • ✅ Consistent experience for both signup methods

Next Steps for Users

After signup, users should:

  1. See the success toast on home page
  2. Wait for admin approval (24-48 hours)
  3. Receive email notification when approved
  4. Return to login page to access their account

Last Updated: October 2, 2025