From 9f2a97c15af18b77f87e3b95da747669692d3aab Mon Sep 17 00:00:00 2001 From: Renato Dehnhardt Date: Thu, 10 Oct 2024 11:38:29 +0200 Subject: [PATCH 1/2] Update auth.js add a redirect rule to the middleware if the user has not verified their email --- src/hooks/auth.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hooks/auth.js b/src/hooks/auth.js index be080aab..967f29b9 100644 --- a/src/hooks/auth.js +++ b/src/hooks/auth.js @@ -102,6 +102,10 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { useEffect(() => { if (middleware === 'guest' && redirectIfAuthenticated && user) router.push(redirectIfAuthenticated) + + if (middleware === 'auth' && !user?.email_verified_at) + router.push('/verify-email') + if ( window.location.pathname === '/verify-email' && user?.email_verified_at From a4e7b15dace38d2af17dc592894f355e704d5668 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 10 Oct 2024 09:44:11 -0500 Subject: [PATCH 2/2] Update auth.js --- src/hooks/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/auth.js b/src/hooks/auth.js index 967f29b9..667f92fc 100644 --- a/src/hooks/auth.js +++ b/src/hooks/auth.js @@ -104,7 +104,7 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { router.push(redirectIfAuthenticated) if (middleware === 'auth' && !user?.email_verified_at) - router.push('/verify-email') + router.push('/verify-email') if ( window.location.pathname === '/verify-email' &&