fix(frontend): harden auth routing and callback error handling
This commit is contained in:
@@ -32,7 +32,17 @@ const error = ref('')
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const code = route.query.code
|
||||
const state = route.query.state
|
||||
const oauthError = route.query.error
|
||||
const oauthErrorDesc = route.query.error_description
|
||||
|
||||
if (oauthError) {
|
||||
const reason = typeof oauthErrorDesc === 'string' && oauthErrorDesc
|
||||
? oauthErrorDesc
|
||||
: String(oauthError)
|
||||
error.value = `登入失敗:${reason}`
|
||||
setTimeout(() => router.push('/login'), 3000)
|
||||
return
|
||||
}
|
||||
|
||||
if (!code) {
|
||||
error.value = '缺少驗證代碼,登入失敗'
|
||||
|
||||
Reference in New Issue
Block a user