feat: redirect to verify when required

This commit is contained in:
2025-06-07 00:13:17 +02:00
parent a50bad417f
commit fb622f918a

View File

@ -31,6 +31,8 @@ const AuthLayout = () => {
const authenticate = useAuth((state) => state.authenticate);
const hasAuthenticated = useAuth((state) => state.hasAuthenticated);
const authProfile = useAuth((s) => s.profile);
const signInRequired = useAuth((state) => state.signInRequired);
const location = useLocation();
@ -136,6 +138,14 @@ const AuthLayout = () => {
);
}
if (
!signInRequired &&
authProfile?.email_verified === false &&
!location.pathname.startsWith("/verify")
) {
return <Navigate to="/verify" />;
}
return (
<BackgroundLayout>
<Outlet />