diff --git a/app/app.vue b/app/app.vue index f8eacfa..fab1d78 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,5 +1,11 @@ + + diff --git a/app/components/ui/toast/Toast.vue b/app/components/ui/toast/Toast.vue new file mode 100644 index 0000000..e82e783 --- /dev/null +++ b/app/components/ui/toast/Toast.vue @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/app/layouts/default.vue b/app/layouts/default.vue index b0fbd8d..018d133 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -40,22 +40,23 @@ onMounted(() => {
- diff --git a/app/middleware/guest.global.js b/app/middleware/guest.global.js new file mode 100644 index 0000000..71bb559 --- /dev/null +++ b/app/middleware/guest.global.js @@ -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('/'); + } +}); \ No newline at end of file diff --git a/app/pages/auth-test.vue b/app/pages/auth-test.vue deleted file mode 100644 index a4bf2ed..0000000 --- a/app/pages/auth-test.vue +++ /dev/null @@ -1,84 +0,0 @@ - - diff --git a/app/pages/auth/forgot-password.vue b/app/pages/auth/forgot-password.vue new file mode 100644 index 0000000..f032be0 --- /dev/null +++ b/app/pages/auth/forgot-password.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/app/pages/auth/login.vue b/app/pages/auth/login.vue index 545ad25..e8711ff 100644 --- a/app/pages/auth/login.vue +++ b/app/pages/auth/login.vue @@ -6,7 +6,7 @@
-

Login

+

Login

@@ -19,24 +19,29 @@ -

{{ errors.email }}

+ ]" placeholder="admin@mail.pt"> +

{{ errors.email }}

- -

{{ errors.password }}

+ ]" placeholder="••••••••" @keyup.enter="handleLogin"> +

{{ errors.password }}

-
- + + + Forgot Password? +
@@ -44,28 +49,6 @@ - + \ No newline at end of file diff --git a/app/pages/index.vue b/app/pages/index.vue index 9b7905c..64eaa22 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -4,7 +4,7 @@
-

+

Academic Management System

@@ -15,17 +15,17 @@