🐛 Forgot condition on resend code

This commit is contained in:
Maxime Lalo 2023-12-01 10:00:53 +01:00
parent af4f51eaab
commit 5a51fc63d0

View File

@ -268,7 +268,7 @@ export default class CustomersService extends BaseService {
// 2: Get last code sent
const totpCodeToResend = customerHydrated.totpCodes?.find((totpCode) => {
return totpCode.uid && totpCodeUid;
return totpCode.uid === totpCodeUid && totpCode.expire_at && totpCode.expire_at.getTime() > now;
});
if (!totpCodeToResend) throw new TotpCodeExpiredError();