Split admin login into its own route and add auth guard to /admin
Deploy with Docker Compose / deploy (push) Successful in 28s

- Add /admin/login route for Login.vue as a standalone page
- Add requiresAdmin guard to /admin route
- Update auth guard redirect to /admin/login with redirect query param
- Update nginx @auth_denied to redirect to /admin/login
- Remove Login component from Admin.vue; drop v-if auth checks (guard handles access)
- Remove stale view files from old views/ structure (moved in prior commit)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-04-13 11:19:10 +01:00
co-authored by Claude Sonnet 4.6
parent 4d154ff837
commit 18b50f1ce6
12 changed files with 15 additions and 501 deletions
+7 -1
View File
@@ -22,10 +22,16 @@ const router = createRouter({
name: "home",
component: () => import("@/views/home/Home.vue"),
},
{
path: "admin/login",
name: "admin-login",
component: () => import("@/views/admin/Login.vue"),
},
{
path: "admin",
name: "admin",
component: () => import("@/views/admin/Admin.vue"),
meta: { requiresAdmin: true },
},
{
path: "bookmarks",
@@ -94,7 +100,7 @@ router.beforeEach(async (to) => {
});
});
}
if (!useAuthStore().user.admin) return "/admin";
if (!useAuthStore().user.admin) return { path: "/admin/login", query: { redirect: to.fullPath } };
});
export default router;