Coming-soon page now shows a magic link login form for unauthenticated visitors and a wiki link + sign out for logged-in members. The coming-soon middleware allows /admin routes through (still protected by admin middleware). A /login redirect page ensures invite email links work.
22 lines
590 B
JavaScript
22 lines
590 B
JavaScript
export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
const config = useRuntimeConfig();
|
|
const isComingSoonMode =
|
|
config.public.comingSoon === "true" || config.public.comingSoon === true;
|
|
|
|
// Only enforce coming soon mode if enabled
|
|
if (!isComingSoonMode) {
|
|
return;
|
|
}
|
|
|
|
// Allow access to the coming-soon page, OIDC login, and admin routes
|
|
if (
|
|
to.path === "/coming-soon" ||
|
|
to.path === "/auth/wiki-login" ||
|
|
to.path.startsWith("/admin")
|
|
) {
|
|
return;
|
|
}
|
|
|
|
// Redirect all other routes to coming-soon
|
|
return navigateTo("/coming-soon");
|
|
});
|