Skip to content

fix: redirect user based on role after login instead of hardcoding admin dashboard#260

Open
pericharlabindhumadhavi-data wants to merge 1 commit into
rdodiya:gssoc_developfrom
pericharlabindhumadhavi-data:fix/role-based-redirect-login
Open

fix: redirect user based on role after login instead of hardcoding admin dashboard#260
pericharlabindhumadhavi-data wants to merge 1 commit into
rdodiya:gssoc_developfrom
pericharlabindhumadhavi-data:fix/role-based-redirect-login

Conversation

@pericharlabindhumadhavi-data

Copy link
Copy Markdown

Closes #240

What was the problem?

After successful authentication, both regular login and Google login flows redirected users to:

/admin/dashboard

This redirect was hardcoded and ignored the role information returned by the authentication response. As a result, non-admin users were incorrectly routed to the admin dashboard.

How was it solved?

  • Removed hardcoded navigation logic.
  • Added role-based redirect handling using the roles returned by the API.
  • Ensured users are redirected to the appropriate destination based on their assigned role.

Impact

  • Prevents unauthorized navigation to admin views.
  • Improves user experience after login.
  • Aligns application routing with role-based access expectations.

Checklist

  • Removed hardcoded dashboard redirects.
  • Added role-aware navigation logic.
  • Tested login flow with different user roles.
  • Followed CONTRIBUTING.md guidelines.

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 always redirects to /admin/dashboard regardless of user role

1 participant