Skip to content

Conversation

@sandeshkhairnar
Copy link

📋 Description

Prevents authenticated users from accessing /auth/signin and /auth/register routes by automatically redirecting them to their intended destination or home page.

🔗 Linked Issue

Closes #292

✨ Changes Made

  • Client-side Protection: Implemented useAuthRouteProtection hook as backup with user-friendly feedback
  • Smart Redirects: Respects redirectTo query parameter for seamless user experience
  • Enhanced Loading States: Added proper skeleton components matching the signin page design

🧪 Testing

  • Authenticated users are redirected from /auth/signin
  • Authenticated users are redirected from /auth/register
  • redirectTo parameter '/ ' works correctly
  • Loading states display properly during auth checks
  • Toast messages provide clear feedback

🎯 Benefits

  • ✅ Prevents user confusion when already authenticated
  • ✅ Provides smooth UX with loading states and feedback

📱 Screenshots

image

- Add middleware logic to redirect authenticated users from /auth/signin and /auth/register
- Implement client-side auth route protection hook
- Add proper skeleton loading states for auth pages
- Include safe redirect handling with redirectTo parameter
- Add user-friendly toast messages for better UX

Fixes Muneerali199#292
@vercel
Copy link

vercel bot commented Aug 12, 2025

@techcroft1 is attempting to deploy a commit to the muneerali199's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Aug 12, 2025

👷 Deploy request for docmagic-muneer pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 4148802

@netlify
Copy link

netlify bot commented Aug 12, 2025

👷 Deploy request for docmagic1 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 4148802

@yashksaini-coder
Copy link
Collaborator

@sandeshkhairnar Please resolve conflicts first

@sandeshkhairnar
Copy link
Author

@yashksaini-coder could you please check if I have resolved the conflict

'/payment-demo',
];

export const AUTH_ROUTES = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have the types created in /utils and then import here to use. Define them in one place together @sandeshkhairnar

@sandeshkhairnar
Copy link
Author

@yashksaini-coder please review the changes and let me know if anything needs to be updated.

image

Copy link
Collaborator

@yashksaini-coder yashksaini-coder left a comment

Choose a reason for hiding this comment

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

👍🏼 Now its proper, @Muneerali199 please check the vercel deployment

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.

[Feature]: Prevent authenticated users from accessing /auth/signin and /auth/register routes

3 participants