Add frontend auth, dashboard & router guards

Introduce a complete frontend auth flow and protected dashboard.

- Add auth session module (GUI/src/services/authSession.ts) with fetchCurrentUser, login, logout, caching and structured errors.
- Add Dashboard page (GUI/src/routes/dashboard/Dashboard.vue) and a protected Dashboard route (meta.requiresAuth) at '/'.
- Move public landing page to /welcome and mark it Visibility.Unauthenticated; update 404 and Impressum links.
- Implement router guard (GUI/src/router/index.ts) to redirect unauthenticated users to Login and prevent logged-in users from accessing guest-only pages.
- Update routes layout (GUI/src/plugins/routesLayout.ts) to include authenticated/unauthenticated visibility and dashboard entry.
- Update Layout.vue to track current user, show username/menu, conditionally render sidebar items, add logout flow and error snackbar, and insert visual divider before auth-only items.
- Convert Login.vue into a working login form with loading state, error handling and redirect after success.
- Update codexInfo.md to document the new auth features and related UI/route changes.
This commit is contained in:
Jonas
2026-04-18 22:42:17 +02:00
parent 38ec3741ab
commit 86ed227566
9 changed files with 759 additions and 53 deletions
+22 -3
View File
@@ -1,6 +1,7 @@
import type { RouteRecordRaw } from 'vue-router'
import Home from '@/routes/Home.vue'
import Dashboard from '@/routes/dashboard/Dashboard.vue'
import NotFound from '@/routes/404NotFound.vue'
import Login from '@/routes/authentication/Login.vue'
import Impressum from '@/routes/Impressum.vue'
@@ -38,17 +39,32 @@ export interface LayoutRoute {
*/
export const routes: LayoutRoute[] = [
{
path: '/',
path: '/welcome',
name: 'Startseite',
description: 'Self-hosted Datei-Workspace für Hoard',
icon: 'mdi-home',
visible: Visibility.Public,
visible: Visibility.Unauthenticated,
meta: {
name: 'Home',
path: '/',
path: '/welcome',
component: Home,
},
},
{
path: '/',
name: 'Dash',
description: 'Geschützter Bereich für dein Konto',
icon: 'mdi-view-dashboard-outline',
visible: Visibility.Authenticated,
meta: {
name: 'Dashboard',
path: '/',
component: Dashboard,
meta: {
requiresAuth: true,
},
},
},
{
path: '/login',
name: 'Login',
@@ -59,6 +75,9 @@ export const routes: LayoutRoute[] = [
path: '/login',
name: 'Login',
component: Login,
meta: {
guestOnly: true,
},
},
},
{