feat: implement account email mismatch error handling and improve user feedback in authentication flows

This commit is contained in:
Junyan Qin
2026-01-01 17:01:32 +08:00
parent 61f08f3218
commit 02e12cc1e4
10 changed files with 60 additions and 19 deletions

View File

@@ -48,9 +48,15 @@ function SpaceOAuthCallbackContent() {
setTimeout(() => {
router.push('/home');
}, 1000);
} catch {
} catch (err) {
setStatus('error');
setErrorMessage(t('common.spaceLoginFailed'));
const errorObj = err as { msg?: string };
const errMsg = (errorObj?.msg || '').toLowerCase();
if (errMsg.includes('account email mismatch')) {
setErrorMessage(t('account.spaceEmailMismatch'));
} else {
setErrorMessage(t('common.spaceLoginFailed'));
}
}
},
[router, t],
@@ -74,9 +80,13 @@ function SpaceOAuthCallbackContent() {
}, 1000);
} catch (err) {
setStatus('error');
setErrorMessage(
err instanceof Error ? err.message : t('account.bindSpaceFailed'),
);
const errorObj = err as { msg?: string };
const errMsg = (errorObj?.msg || '').toLowerCase();
if (errMsg.includes('account email mismatch')) {
setErrorMessage(t('account.spaceEmailMismatch'));
} else {
setErrorMessage(t('account.bindSpaceFailed'));
}
} finally {
setIsProcessing(false);
}