desactivate sms in dev env

This commit is contained in:
Vins 2023-12-05 11:28:18 +01:00
parent b07e25a439
commit 82239adeeb

View File

@ -1,4 +1,4 @@
// import { BackendVariables } from "@Common/config/variables/Variables"; import { BackendVariables } from "@Common/config/variables/Variables";
import { Customers, Prisma, TotpCodes } from "@prisma/client"; import { Customers, Prisma, TotpCodes } from "@prisma/client";
import CustomersRepository from "@Repositories/CustomersRepository"; import CustomersRepository from "@Repositories/CustomersRepository";
import TotpCodesRepository from "@Repositories/TotpCodesRepository"; import TotpCodesRepository from "@Repositories/TotpCodesRepository";
@ -57,7 +57,7 @@ export default class CustomersService extends BaseService {
private customerRepository: CustomersRepository, private customerRepository: CustomersRepository,
private authService: AuthService, private authService: AuthService,
private totpCodesRepository: TotpCodesRepository, private totpCodesRepository: TotpCodesRepository,
// private variables: BackendVariables, private variables: BackendVariables,
private ovhService: OvhService, private ovhService: OvhService,
private smsFactorService: SmsFactorService, private smsFactorService: SmsFactorService,
) { ) {
@ -110,8 +110,7 @@ export default class CustomersService extends BaseService {
const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), reason); const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), reason);
if (!totpCode) return null; if (!totpCode) return null;
// 5: Send the SMS code to the customer // 5: Send the SMS code to the customer
// if(this.variables.ENV !== 'dev') if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer);
await this.sendSmsCodeToCustomer(totpPin, customer);
return { return {
customer, customer,
totpCode: TotpCodesResource.hydrate<TotpCodesResource>({ totpCode: TotpCodesResource.hydrate<TotpCodesResource>({
@ -163,8 +162,7 @@ export default class CustomersService extends BaseService {
await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60000), TotpCodesReasons.RESET_PASSWORD); await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60000), TotpCodesReasons.RESET_PASSWORD);
// 5: Send the SMS code to the customer // 5: Send the SMS code to the customer
// if(this.variables.ENV !== 'dev') if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer);
await this.sendSmsCodeToCustomer(totpPin, customer);
return customer; return customer;
} }
@ -294,8 +292,7 @@ export default class CustomersService extends BaseService {
const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), totpCodeToResend.reason!, true); const totpCode = await this.saveTotpPin(customer, totpPin, new Date(now + 5 * 60 * 1000), totpCodeToResend.reason!, true);
// 7: Send the SMS code to the customer // 7: Send the SMS code to the customer
// if(this.variables.ENV !== 'dev') if(this.variables.ENV !== 'dev') await this.sendSmsCodeToCustomer(totpPin, customer);
await this.sendSmsCodeToCustomer(totpPin, customer);
return { customer, totpCode }; return { customer, totpCode };
} }