refactor(EnvelopeMailService): Hinzufügen von [TFA_EXPIRATION] über optionale Platzhalter in der Methode SendTFAQrCodeAsync.

This commit is contained in:
Developer 02 2024-12-11 14:45:36 +01:00
parent 030fd0e45b
commit c6fc665002

View File

@ -164,11 +164,14 @@ namespace EnvelopeGenerator.Application.Services
throw new ArgumentNullException(nameof(dto), $"TFA Qr Code cannot sent. Receiver information is missing. Envelope receiver dto is {JsonConvert.SerializeObject(dto)}");
if (dto.Receiver.TotpSecretkey is null)
throw new ArgumentNullException(nameof(dto), $"TFA Qr Code cannot sent. Receiver.TotpSecretKey is null. Envelope receiver dto is {JsonConvert.SerializeObject(dto)}");
if (dto.Receiver.TotpExpiration is null)
throw new ArgumentNullException(nameof(dto), $"TFA Qr Code cannot sent. Receiver.TotpExpiration is null. Envelope receiver dto is {JsonConvert.SerializeObject(dto)}");
var totp_qr_64 = _codeGenerator.GenerateTotpQrCode(userEmail: dto.Receiver.EmailAddress, secretKey: dto.Receiver.TotpSecretkey).ToBase64String();
return SendAsync(dto, EmailTemplateType.TotpSecret, new()
{
{"[TFA_QR_CODE]", totp_qr_64 }
{"[TFA_QR_CODE]", totp_qr_64 },
{"[TFA_EXPIRATION]", dto.Receiver.TotpExpiration }
});
}
}