From 67dfcaec5f8b98266c4938d3c3c9feb43e86b2cd Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Fri, 15 Dec 2023 16:03:31 +0100 Subject: [PATCH] :sparkles: Errors in french for front --- .../CustomersService/CustomersService.ts | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/services/customer/CustomersService/CustomersService.ts b/src/services/customer/CustomersService/CustomersService.ts index ce8d6fff..f307e2cc 100644 --- a/src/services/customer/CustomersService/CustomersService.ts +++ b/src/services/customer/CustomersService/CustomersService.ts @@ -12,43 +12,43 @@ import SmsFactorService from "@Services/common/SmsFactorService/SmsFactorService export class SmsNotExpiredError extends Error { constructor() { - super("SMS code not expired"); + super("Code déjà envoyé"); } } export class TotpCodeExpiredError extends Error { constructor() { - super("Totp code not found or expired"); + super("Code non trouvé ou expiré"); } } export class InvalidTotpCodeError extends Error { constructor() { - super("Invalid Totp code"); + super("Code invalide"); } } export class NotRegisteredCustomerError extends Error { constructor() { - super("Customer not registered"); + super("Ce client n'existe pas"); } } export class InvalidPasswordError extends Error { constructor() { - super("Invalid password"); + super("Mot de passe incorrect"); } } export class PasswordAlreadySetError extends Error { constructor() { - super("Password already set"); + super("Le mot de passe a déjà été défini"); } } export class TooSoonForNewCode extends Error { constructor() { - super("You need to wait at least 30 seconds before asking for a new code"); + super("Vous devez attendre 30 secondes avant de pouvoir demander un nouveau code"); } } @Service() @@ -110,7 +110,7 @@ export default class CustomersService extends BaseService { const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), reason); if (!totpCode) return null; // 5: Send the SMS code to the customer - if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer); + if (this.variables.ENV !== "dev") await this.sendSmsCodeToCustomer(totpPin, customer); return { customer, totpCode: TotpCodesResource.hydrate({ @@ -162,7 +162,7 @@ export default class CustomersService extends BaseService { await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60000), TotpCodesReasons.RESET_PASSWORD); // 5: Send the SMS code to the customer - if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer); + if (this.variables.ENV !== "dev") await this.sendSmsCodeToCustomer(totpPin, customer); return customer; } @@ -292,7 +292,7 @@ export default class CustomersService extends BaseService { const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), totpCodeToResend.reason!, true); // 7: Send the SMS code to the customer - if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer); + if (this.variables.ENV !== "dev") await this.sendSmsCodeToCustomer(totpPin, customer); return { customer, totpCode }; } @@ -356,14 +356,13 @@ export default class CustomersService extends BaseService { private async sendSmsCodeToCustomer(totpPin: number, customer: Customer) { const message = "Votre code de vérification LEcoffre.io est : " + totpPin.toString(); - + // Sélectionnez le fournisseur de SMS en fonction de la variable d'environnement //const selectedProvider = this.variables.SMS_PROVIDER === "OVH" ? this.ovhService : this.smsFactorService; // Envoi du SMS if (!customer.contact?.cell_phone_number) return; - let success = await this.ovhService.sendSms(customer.contact?.cell_phone_number, message); - + let success = await this.ovhService.sendSms(customer.contact?.cell_phone_number, message); // Si l'envoi échoue, basculez automatiquement sur le second fournisseur if (!success) {