diff --git a/app/middleware/coming-soon.global.js b/app/middleware/coming-soon.global.js index 11dc3cc..c1ee747 100644 --- a/app/middleware/coming-soon.global.js +++ b/app/middleware/coming-soon.global.js @@ -12,6 +12,10 @@ export default defineNuxtRouteMiddleware(async (to, from) => { 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; diff --git a/app/pages/auth/wiki-login.vue b/app/pages/auth/wiki-login.vue index a135fa2..2ce8dbf 100644 --- a/app/pages/auth/wiki-login.vue +++ b/app/pages/auth/wiki-login.vue @@ -8,6 +8,7 @@ const uid = route.query.uid as string; const email = ref(""); const sent = ref(false); +const notRegistered = ref(false); const loading = ref(false); const error = ref(""); @@ -15,13 +16,21 @@ async function sendMagicLink() { if (!email.value || !uid) return; loading.value = true; error.value = ""; + notRegistered.value = false; try { - await $fetch("/oidc/interaction/login", { - method: "POST", - body: { email: email.value, uid }, - }); - sent.value = true; + const response = await $fetch<{ success: boolean; registered: boolean }>( + "/oidc/interaction/login", + { + method: "POST", + body: { email: email.value, uid }, + } + ); + if (response.registered === false) { + notRegistered.value = true; + } else { + sent.value = true; + } } catch (e: any) { error.value = e?.data?.statusMessage || "Something went wrong. Please try again."; @@ -29,6 +38,12 @@ async function sendMagicLink() { loading.value = false; } } + +function resetForm() { + sent.value = false; + notRegistered.value = false; + email.value = ""; +}