From 7d31dc3ffa094683c17b81dbf0ee8a555a34da09 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Thu, 4 Jun 2026 14:06:45 +0300 Subject: [PATCH] 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. --- src/locales/en.json | 3 ++- src/locales/fa.json | 3 ++- src/locales/ru.json | 3 ++- src/locales/zh.json | 3 ++- src/pages/ConnectedAccounts.tsx | 7 ++++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 4f2a27b..b36979e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -4594,7 +4594,8 @@ "vk": "VK" }, "backToAccounts": "Back to accounts" - } + }, + "emailMergePasswordRequired": "This email already belongs to another account. To merge the accounts, enter that account's password." }, "theme": { "colors": "Theme Colors", diff --git a/src/locales/fa.json b/src/locales/fa.json index fd2cc4d..e189012 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -4139,7 +4139,8 @@ "vk": "VK" }, "backToAccounts": "بازگشت به فهرست حساب‌ها" - } + }, + "emailMergePasswordRequired": "این ایمیل قبلاً به حساب دیگری تعلق دارد. برای ادغام حساب‌ها، رمز عبور آن حساب را وارد کنید." }, "theme": { "colors": "رنگ‌های تم", diff --git a/src/locales/ru.json b/src/locales/ru.json index 672c5a1..2a9899d 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -5146,7 +5146,8 @@ "vk": "VK" }, "backToAccounts": "К списку аккаунтов" - } + }, + "emailMergePasswordRequired": "Этот email уже привязан к другому аккаунту. Чтобы объединить аккаунты, введите пароль от него." }, "theme": { "colors": "Цвета темы", diff --git a/src/locales/zh.json b/src/locales/zh.json index c196113..557fb7c 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -4138,7 +4138,8 @@ "vk": "VK" }, "backToAccounts": "返回账户列表" - } + }, + "emailMergePasswordRequired": "该邮箱已属于另一个账户。要合并账户,请输入该账户的密码。" }, "theme": { "colors": "主题颜色", diff --git a/src/pages/ConnectedAccounts.tsx b/src/pages/ConnectedAccounts.tsx index 43df293..0d81f42 100644 --- a/src/pages/ConnectedAccounts.tsx +++ b/src/pages/ConnectedAccounts.tsx @@ -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'));