mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(connected-accounts): guide the user to enter the existing account's password when merging by email
The backend account-takeover fix now requires the existing account's password before merging an email that already belongs to another account. Show a clear message (profile.emailMergePasswordRequired) on that response instead of the generic "already registered" dead-end, so the legitimate owner knows to enter that account's password (in both password fields) to complete the merge. i18n in ru/en/zh/fa.
This commit is contained in:
@@ -409,7 +409,12 @@ export default function ConnectedAccounts() {
|
||||
},
|
||||
onError: (err: { response?: { data?: { detail?: string } } }) => {
|
||||
const detail = err.response?.data?.detail;
|
||||
if (detail?.includes('already registered')) {
|
||||
// The email belongs to another account and merging it requires proving
|
||||
// ownership: the backend asks for THAT account's password (account-takeover
|
||||
// fix). Guide the user to enter it rather than showing a dead-end error.
|
||||
if (detail?.includes('merge')) {
|
||||
setEmailError(t('profile.emailMergePasswordRequired'));
|
||||
} else if (detail?.includes('already registered')) {
|
||||
setEmailError(t('profile.emailAlreadyRegistered'));
|
||||
} else if (detail?.includes('already have a verified email')) {
|
||||
setEmailError(t('profile.alreadyHaveEmail'));
|
||||
|
||||
Reference in New Issue
Block a user