Revert "Add popup-based Google login function"

This reverts commit 1b39289dad.
This commit is contained in:
tim
2025-08-03 20:07:59 +08:00
parent 5aeedb07fe
commit 3a0cea8cd4
3 changed files with 7 additions and 43 deletions

View File

@@ -12,23 +12,7 @@ export async function googleGetIdToken() {
window.google.accounts.id.initialize({
client_id: GOOGLE_CLIENT_ID,
callback: ({ credential }) => resolve(credential),
use_fedcm: true
})
window.google.accounts.id.prompt()
})
}
export async function googleGetIdTokenWithPop() {
return new Promise((resolve, reject) => {
if (!window.google || !GOOGLE_CLIENT_ID) {
toast.error('Google 登录不可用, 请检查网络设置与VPN')
reject()
return
}
window.google.accounts.id.initialize({
client_id: GOOGLE_CLIENT_ID,
callback: ({ credential }) => resolve(credential),
ux_mode: 'popup'
use_fedcm: true
})
window.google.accounts.id.prompt()
})
@@ -69,15 +53,6 @@ export async function googleSignIn(redirect_success, redirect_not_approved) {
}
}
export async function googleSignInWithPop(redirect_success, redirect_not_approved) {
try {
const token = await googleGetIdTokenWithPop()
await googleAuthWithToken(token, redirect_success, redirect_not_approved)
} catch {
/* ignore */
}
}
import router from '../router'
export function loginWithGoogle() {
@@ -89,15 +64,4 @@ export function loginWithGoogle() {
router.push('/signup-reason?token=' + token)
}
)
}
export function loginWithGoogleWithPop() {
googleSignInWithPop(
() => {
router.push('/')
},
token => {
router.push('/signup-reason?token=' + token)
}
)
}