From 2ca29e12515b0db3fc3b68cbf03b92c1cc137a34 Mon Sep 17 00:00:00 2001 From: Emmanuelle Bonnemay Date: Fri, 15 Nov 2024 08:30:38 +0100 Subject: [PATCH] refactor(api): handle account recovery case --- .../account-recovery/account-recovery.route.test.js | 2 +- .../account-recovery/backup-email-confirmation-form.hbs | 4 +++- mon-pix/app/controllers/account-recovery/find-sco-record.js | 2 +- mon-pix/translations/en.json | 1 + mon-pix/translations/es.json | 1 + mon-pix/translations/fr.json | 1 + mon-pix/translations/nl.json | 1 + 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/tests/identity-access-management/acceptance/application/account-recovery/account-recovery.route.test.js b/api/tests/identity-access-management/acceptance/application/account-recovery/account-recovery.route.test.js index 69f7a421b96..e8c410a8ee6 100644 --- a/api/tests/identity-access-management/acceptance/application/account-recovery/account-recovery.route.test.js +++ b/api/tests/identity-access-management/acceptance/application/account-recovery/account-recovery.route.test.js @@ -234,7 +234,7 @@ describe('Acceptance | Identity Access Management | Application | Route | accoun // then expect(response.statusCode).to.equal(400); - expect(response.result.errors[0].detail).to.equal('Cette adresse e-mail est déjà utilisée.'); + expect(response.result.errors[0].detail).to.equal('Cette adresse e-mail est invalide ou déjà utilisée.'); }); }); }); diff --git a/mon-pix/app/components/account-recovery/backup-email-confirmation-form.hbs b/mon-pix/app/components/account-recovery/backup-email-confirmation-form.hbs index 7d1a0bef589..ad5dd4b4fad 100644 --- a/mon-pix/app/components/account-recovery/backup-email-confirmation-form.hbs +++ b/mon-pix/app/components/account-recovery/backup-email-confirmation-form.hbs @@ -43,7 +43,9 @@ class="account-recovery__content--not-found-error" id="backup-email-confirmation-already-use-error-message" > - {{t "pages.account-recovery.find-sco-record.backup-email-confirmation.form.error.new-email-already-exist"}} + {{t + "pages.account-recovery.find-sco-record.backup-email-confirmation.form.error.invalid-or-already-used-email" + }} {{/if}} diff --git a/mon-pix/app/controllers/account-recovery/find-sco-record.js b/mon-pix/app/controllers/account-recovery/find-sco-record.js index ec7bc2664d0..38ba24fbb7a 100644 --- a/mon-pix/app/controllers/account-recovery/find-sco-record.js +++ b/mon-pix/app/controllers/account-recovery/find-sco-record.js @@ -109,7 +109,7 @@ export default class FindScoRecordController extends Controller { const hasInternalErrorOrConflictOrAlreadyLeftSco = status === 403 || status === 409 || status >= 500 || isApiUnreachable; const isEmailAlreadyRegistered = - this.showBackupEmailConfirmationForm && status === 400 && code === 'ACCOUNT_WITH_EMAIL_ALREADY_EXISTS'; + this.showBackupEmailConfirmationForm && status === 400 && code === 'INVALID_OR_ALREADY_USED_EMAIL'; if (!hasInternalErrorOrConflictOrAlreadyLeftSco || isEmailAlreadyRegistered) { this._showErrorOnComponent(isEmailAlreadyRegistered); diff --git a/mon-pix/translations/en.json b/mon-pix/translations/en.json index 45973909063..a5303bacdf7 100644 --- a/mon-pix/translations/en.json +++ b/mon-pix/translations/en.json @@ -344,6 +344,7 @@ "new-email": ",if not, enter a new one." }, "empty-email": "The e-mail address field is mandatory.", + "invalid-or-already-used-email" : "Invalid or already used e-mail address", "new-backup-email": "Please enter a valid e-mail address to recover your account", "new-email-already-exist": "This e-mail address is already in use", "wrong-email-format": "Your e-mail address is invalid." diff --git a/mon-pix/translations/es.json b/mon-pix/translations/es.json index 862ccfeeabf..05950738c40 100644 --- a/mon-pix/translations/es.json +++ b/mon-pix/translations/es.json @@ -361,6 +361,7 @@ "new-email": ", de lo contrario, introduce una nueva." }, "empty-email": "El campo de dirección de correo electrónico es obligatorio.", + "invalid-or-already-used-email" : "Invalid or already used e-mail address", "new-backup-email": "Introduce una dirección de correo electrónico válida para restablecer tu cuenta", "new-email-already-exist": "Esta dirección de correo electrónico ya se está utilizando", "wrong-email-format": "Tu dirección de correo electrónico no es válida." diff --git a/mon-pix/translations/fr.json b/mon-pix/translations/fr.json index 70cff2188e3..551e8bcac25 100644 --- a/mon-pix/translations/fr.json +++ b/mon-pix/translations/fr.json @@ -344,6 +344,7 @@ "new-email": ", sinon saisissez une nouvelle." }, "empty-email": "Le champ adresse e-mail est obligatoire.", + "invalid-or-already-used-email" : "Adresse e-mail invalide ou déjà utilisée", "new-backup-email": "Veuillez saisir un e-mail valide pour récupérer votre compte", "new-email-already-exist": "Cette adresse e-mail est déjà utilisée", "wrong-email-format": "Votre adresse e-mail n’est pas valide." diff --git a/mon-pix/translations/nl.json b/mon-pix/translations/nl.json index 12e20318eaa..02571de2364 100644 --- a/mon-pix/translations/nl.json +++ b/mon-pix/translations/nl.json @@ -361,6 +361,7 @@ "new-email": "Zo niet, voer dan een nieuwe in." }, "empty-email": "Het e-mailadresveld is verplicht.", + "invalid-or-already-used-email" : "Invalid or already used e-mail address", "new-backup-email": "Voer een geldig e-mailadres in om uw account te herstellen", "new-email-already-exist": "Dit e-mailadres is al in gebruik", "wrong-email-format": "Uw e-mailadres is ongeldig."