fix: avoid social callback session race
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user