forget and recover password functionalities

This commit is contained in:
Edd
2026-01-18 01:37:27 +00:00
parent 0fe0b444c2
commit 9c0dca8f13
11 changed files with 333 additions and 145 deletions
+20
View File
@@ -0,0 +1,20 @@
export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore();
const isLoggedIn = !!(authStore.user || authStore.token);
const mustChangePassword = authStore.user?.mustChangePassword === true;
const isAuthPage = to.path.startsWith('/auth');
const isUpdatePasswordPage = to.path === '/profile/update-password';
if (!isLoggedIn && !isAuthPage) {
return navigateTo('/auth/login');
}
if (isLoggedIn && mustChangePassword && !isUpdatePasswordPage) {
return navigateTo('/profile/update-password');
}
if (isLoggedIn && isAuthPage) {
return navigateTo('/');
}
});