mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat(connected-accounts): email-merge confirmation via emailed one-time code
When linking an email that belongs to another account, the backend now mails a one-time code to it (merge_verification='email_code') instead of asking for that account's password. Add a 6-digit code step: on the email_code response show the code input, verify via authApi.verifyEmailMerge → on success redirect to /merge. Preview/execute already go through apiClient (JWT), so they satisfy the new initiator-bound merge endpoints. i18n in ru/en/zh/fa.
This commit is contained in:
@@ -87,7 +87,10 @@ export const authApi = {
|
||||
message: string;
|
||||
email?: string;
|
||||
merge_required?: boolean;
|
||||
merge_token?: string;
|
||||
// 'email_code' means the email belongs to another account: a confirmation
|
||||
// code was mailed to it and must be verified before a merge token is issued.
|
||||
merge_verification?: 'email_code';
|
||||
merge_token?: string | null;
|
||||
}> => {
|
||||
const response = await apiClient.post('/cabinet/auth/email/register', {
|
||||
email,
|
||||
@@ -97,6 +100,14 @@ export const authApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Confirm an email account merge with the code sent to the existing account.
|
||||
verifyEmailMerge: async (
|
||||
code: string,
|
||||
): Promise<{ message: string; merge_required?: boolean; merge_token?: string }> => {
|
||||
const response = await apiClient.post('/cabinet/auth/email/merge/verify', { code });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
registerEmailStandalone: async (data: {
|
||||
email: string;
|
||||
password: string;
|
||||
|
||||
Reference in New Issue
Block a user