forked from Cookies_Github_mirror/AquaDX
fix: 🎨 migrate from / to /confirm for email confirmation
This commit is contained in:
@@ -79,6 +79,7 @@
|
|||||||
|
|
||||||
<Router {url}>
|
<Router {url}>
|
||||||
<Route path="/" component={Welcome} />
|
<Route path="/" component={Welcome} />
|
||||||
|
<Route path="/confirm" component={Welcome} /> <!-- For email confirmation only, backwards compatibility with AquaNet2 in the future -->
|
||||||
<Route path="/home" component={Home} />
|
<Route path="/home" component={Home} />
|
||||||
<Route path="/ranking" component={Ranking} />
|
<Route path="/ranking" component={Ranking} />
|
||||||
<Route path="/ranking/:game" component={Ranking} />
|
<Route path="/ranking/:game" component={Ranking} />
|
||||||
|
|||||||
@@ -24,23 +24,26 @@
|
|||||||
if (USER.isLoggedIn()) {
|
if (USER.isLoggedIn()) {
|
||||||
window.location.href = "/home"
|
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'
|
||||||
state = 'verify'
|
verifyMsg = t("welcome.verifying")
|
||||||
verifyMsg = t("welcome.verifying")
|
submitting = true
|
||||||
submitting = true
|
|
||||||
|
|
||||||
// Send request to server
|
// Send request to server
|
||||||
USER.confirmEmail(params.get('confirm-email')!)
|
USER.confirmEmail(params.get('confirm-email')!)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
verifyMsg = t('welcome.verified')
|
verifyMsg = t('welcome.verified')
|
||||||
submitting = false
|
submitting = false
|
||||||
|
|
||||||
// Clear the query param
|
// Clear the query param
|
||||||
window.history.replaceState({}, document.title, window.location.pathname)
|
window.history.replaceState({}, document.title, window.location.pathname)
|
||||||
})
|
})
|
||||||
.catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message }))
|
.catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message }))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit(): Promise<any> {
|
async function submit(): Promise<any> {
|
||||||
submitting = true
|
submitting = true
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class EmailService(
|
|||||||
.withSubject("Confirm Your Email Address for AquaNet")
|
.withSubject("Confirm Your Email Address for AquaNet")
|
||||||
.withHTMLText(confirmTemplate
|
.withHTMLText(confirmTemplate
|
||||||
.replace("{{name}}", user.computedName)
|
.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}") }
|
.buildEmail()).thenRun { log.info("Confirmation email sent to ${user.email}") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user