Make demo login gate backend-authoritative

This commit is contained in:
AzuTear
2026-06-25 09:29:25 +02:00
parent fef1d36fe8
commit f851e500f7
3 changed files with 9 additions and 5 deletions
+4 -2
View File
@@ -4,7 +4,7 @@ import { useAuthStore } from './stores/auth'
import { useAwardsStore } from './stores/awards'
import { routes } from './router/routes'
const DEMO_GATE_HARD_DISABLED = import.meta.env.VITE_DEMO_GATE_ENABLED === 'false'
const DEMO_GATE_FALLBACK_ENABLED = import.meta.env.VITE_DEMO_GATE_ENABLED !== 'false'
const contentAdminRoutes = new Set(['admin-content', 'admin-settings'])
const router = createRouter({
@@ -35,7 +35,9 @@ router.beforeEach(async (to) => {
const isAdminRoute = to.path.startsWith('/admin')
const isMaintenancePreview = isMaintenanceRoute && to.query.preview === 'true'
const siteStatus = await loadSiteStatus()
const demoGateEnabled = !DEMO_GATE_HARD_DISABLED && siteStatus?.demoLoginEnabled !== false
const demoGateEnabled = siteStatus
? siteStatus.demoLoginEnabled
: DEMO_GATE_FALLBACK_ENABLED
if (isMaintenancePreview && !authStore.isAdmin) {
return { name: 'login', query: { redirect: to.fullPath } }