diff --git a/vue/src/views/admin/Login.vue b/vue/src/views/admin/Login.vue index 622eb0e..5a728a4 100644 --- a/vue/src/views/admin/Login.vue +++ b/vue/src/views/admin/Login.vue @@ -20,9 +20,24 @@ const password = ref(""); const submitting = ref(false); const errorMsg = ref(""); +// stppriv's gate sends people here with an absolute priv. URL. +function isPrivUrl(dest) { + try { + const url = new URL(dest); + return url.protocol === "https:" && url.host === `priv.${window.location.hostname.replace(/^www\./, "")}`; + } catch { + return false; + } +} + // Caddy-gated paths aren't Vue routes, so landing on "404" means a full page -// load. Only site-relative paths are followed, or it's an open redirect. +// load. Only site-relative paths (and stppriv) are followed, or it's an open +// redirect. function goTo(dest) { + if (isPrivUrl(dest)) { + window.location.assign(dest); + return; + } if (typeof dest !== "string" || !dest.startsWith("/") || dest.startsWith("//")) { router.push(home()); return;