fix: avoid social callback session race

This commit is contained in:
237899745
2026-05-28 21:23:57 +08:00
parent edc843951b
commit 14713296f3
10 changed files with 49 additions and 38 deletions

View File

@@ -215,6 +215,13 @@ function savePendingSocialBind(data) {
}
}
function hasSocialCallback() {
const params = new URLSearchParams(window.location.search || '')
const provider = String(params.get('provider') || params.get('type') || '').trim()
const code = String(params.get('code') || '').trim()
return Boolean(provider && code)
}
async function handleSocialCallback() {
const params = new URLSearchParams(window.location.search || '')
const provider = String(params.get('provider') || params.get('type') || '').trim()
@@ -391,8 +398,11 @@ function goRegister() {
}
onMounted(async () => {
if (hasSocialCallback()) {
await handleSocialCallback()
return
}
await loadSocialConfig()
await handleSocialCallback()
if (needCaptcha.value) {
await refreshLoginCaptcha()
}