ghostguild-org/app/middleware/coming-soon.global.js
Jennie Robinson Faber 1e9e9c4d97
Some checks failed
Test / vitest (push) Failing after 6m9s
Test / playwright (push) Has been skipped
Test / visual (push) Has been skipped
Test / Notify on failure (push) Successful in 2s
fix(auth): stop wiki login loop to coming-soon and surface non-member state
Members (and pre-registrants) hitting wiki.ghostguild.org were getting bounced
to /coming-soon with a "Pre-Register" link, even when the OIDC flow was
working correctly.

- Allowlist /auth/oidc-error, /auth/logout-confirm, /auth/logout-success,
  and /verify in the coming-soon middleware so OIDC errors and main-site
  magic links stop redirecting to the pre-register page.
- Raise OIDC Interaction TTL from 10m to 15m so it outlives the magic-link
  JWT and legitimate members don't hit expired-interaction errors when they
  click the email a few minutes late.
- Differentiate the "email isn't a registered member" response on the wiki
  login route and show a dedicated "Not a member yet" state with a
  pre-register link and contact email, instead of the misleading
  "Check your inbox" that silently failed.
2026-04-15 17:55:55 +01:00

26 lines
741 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 === "/auth/oidc-error" ||
to.path === "/auth/logout-confirm" ||
to.path === "/auth/logout-success" ||
to.path === "/verify" ||
to.path.startsWith("/admin")
) {
return;
}
// Redirect all other routes to coming-soon
return navigateTo("/coming-soon");
});