π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Fix auth mid frontend (fix redirect loop)
Smaug67396c9a4f40abb3
diff --git a/frontend/middleware/authentification.global.ts b/frontend/middleware/authentification.global.tsindex 3e794e18..a5dc7d5d 100644--- a/frontend/middleware/authentification.global.ts+++ b/frontend/middleware/authentification.global.ts@@ -2,22 +2,22 @@ export default defineNuxtRouteMiddleware(async (to, _) => {if (!import.meta.client) return;const user_auth = localStorage.getItem('isLoggedIn');- if (to.fullPath.startsWith('/dashboard/admin')) {- const user = await useUserStore().fetch();- if (user && user.role === 2) return;+ if (to.fullPath.startsWith('/dashboard') && !user_auth) {return navigateTo({- path: '/dashboard',+ path: '/login',+ query: { redirect: to.fullPath },});}- if (to.fullPath.startsWith('/dashboard') && !user_auth) {+ if (to.fullPath.startsWith('/dashboard/admin')) {+ const user = await useUserStore().fetch();+ if (user && user.role === 2) return;return navigateTo({- path: '/login',- query: { redirect: to.fullPath },+ path: '/dashboard',});}- if (to.fullPath.startsWith('/login') && user_auth) {+ if (to.fullPath.startsWith('/login') || (to.fullPath.startsWith('/signup') && user_auth)) {return navigateTo({path: '/dashboard',});