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:
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user