fix: keep users signed in after password reset

This commit is contained in:
2026-05-31 16:12:52 +08:00
parent b6c3653b64
commit 905a8f2f56
+4 -5
View File
@@ -49,7 +49,7 @@ function startCountdown() {
countdown.value--
if (countdown.value <= 0) {
if (countdownTimer) clearInterval(countdownTimer)
router.push('/login')
router.push('/')
}
}, 1000)
}
@@ -92,7 +92,6 @@ async function handleResetPassword() {
const { error: updateError } = await supabase.auth.updateUser({ password: password.value })
if (updateError) throw updateError
await supabase.auth.signOut()
window.history.replaceState(null, '', window.location.pathname)
countdown.value = 5
state.value = 'success'
@@ -124,12 +123,12 @@ onUnmounted(() => {
v-if="state === 'success'"
status="success"
title="密码已重置"
description="现在可以使用新密码登录。"
description="你已使用新密码完成更新,正在返回地图页。"
>
<template #footer>
<div class="space-y-4">
<p class="text-sm text-slate-500">{{ countdown }} 秒后自动跳转登录页面...</p>
<NButton type="primary" class="oc-primary-button oc-primary-button--teal" @click="router.push('/login')">返回登录</NButton>
<p class="text-sm text-slate-500">{{ countdown }} 秒后自动跳转地图页面...</p>
<NButton type="primary" class="oc-primary-button oc-primary-button--teal" @click="router.push('/')">进入地图</NButton>
</div>
</template>
</NResult>