feat: allow bypass of reset-password and verify routes for logged-in users
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -264,7 +264,13 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If already logged in and trying to access /auth or landing, redirect to appropriate view
|
// If already logged in and trying to access /auth or landing, redirect to appropriate view
|
||||||
if ((to.path.startsWith('/auth') || to.path === '/') && isUserLoggedIn.value) {
|
// Allow reset-password and verify through even when logged in (valid use-case from profile page)
|
||||||
|
const authBypassRoutes = ['/auth/reset-password', '/auth/verify']
|
||||||
|
if (
|
||||||
|
(to.path.startsWith('/auth') || to.path === '/') &&
|
||||||
|
isUserLoggedIn.value &&
|
||||||
|
!authBypassRoutes.some((p) => to.path.startsWith(p))
|
||||||
|
) {
|
||||||
if (isParentAuthenticated.value) {
|
if (isParentAuthenticated.value) {
|
||||||
return next('/parent')
|
return next('/parent')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user