diff --git a/AquaNet/src/App.svelte b/AquaNet/src/App.svelte index cc9d363e..8e5a8944 100644 --- a/AquaNet/src/App.svelte +++ b/AquaNet/src/App.svelte @@ -79,6 +79,7 @@ + diff --git a/AquaNet/src/pages/Welcome.svelte b/AquaNet/src/pages/Welcome.svelte index 669c56eb..d655c93b 100644 --- a/AquaNet/src/pages/Welcome.svelte +++ b/AquaNet/src/pages/Welcome.svelte @@ -24,23 +24,26 @@ if (USER.isLoggedIn()) { window.location.href = "/home" } +if (location.pathname !== '/') { + location.href = `/${params.get('confirm-email') ? `?confirm-email=${params.get('confirm-email')}` : ""}` + } else + if (params.get('confirm-email')) { - if (params.get('confirm-email')) { - state = 'verify' - verifyMsg = t("welcome.verifying") - submitting = true + state = 'verify' + verifyMsg = t("welcome.verifying") + submitting = true - // Send request to server - USER.confirmEmail(params.get('confirm-email')!) - .then(() => { - verifyMsg = t('welcome.verified') - submitting = false + // Send request to server + USER.confirmEmail(params.get('confirm-email')!) + .then(() => { + verifyMsg = t('welcome.verified') + submitting = false - // Clear the query param - window.history.replaceState({}, document.title, window.location.pathname) - }) - .catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message })) - } + // Clear the query param + window.history.replaceState({}, document.title, window.location.pathname) + }) + .catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message })) + } async function submit(): Promise { submitting = true diff --git a/src/main/java/icu/samnyan/aqua/net/components/Email.kt b/src/main/java/icu/samnyan/aqua/net/components/Email.kt index 0129dfa6..2acded03 100644 --- a/src/main/java/icu/samnyan/aqua/net/components/Email.kt +++ b/src/main/java/icu/samnyan/aqua/net/components/Email.kt @@ -76,7 +76,7 @@ class EmailService( .withSubject("Confirm Your Email Address for AquaNet") .withHTMLText(confirmTemplate .replace("{{name}}", user.computedName) - .replace("{{url}}", "https://${props.webHost}?confirm-email=$token")) + .replace("{{url}}", "https://${props.webHost}/confirm?confirm-email=$token")) .buildEmail()).thenRun { log.info("Confirmation email sent to ${user.email}") } }