feat(HomeController): Befehl zum Senden von E-Mails hinzugefügt, um QR-Code zu senden.
- TotpSecret zu EmailTemplateType hinzugefügt.
This commit is contained in:
parent
7f1009e402
commit
535ca23c86
@ -1,5 +1,6 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ namespace EnvelopeGenerator.Application.DTOs.Receiver
|
|||||||
|
|
||||||
public string? TotpSecretkey { get; set; } = null;
|
public string? TotpSecretkey { get; set; } = null;
|
||||||
|
|
||||||
|
[TemplatePlaceholder("[TFA_QR_EXPIRATION]")]
|
||||||
public DateTime? TotpExpiration { get; set; } = null;
|
public DateTime? TotpExpiration { get; set; } = null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
_placeholders = mailConfig.Value.Placeholders;
|
_placeholders = mailConfig.Value.Placeholders;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Dictionary<string, string>> CreatePlaceholders(string? accessCode = null, EnvelopeReceiverDto? envelopeReceiverDto = null, EnvelopeReceiverReadOnlyDto? readOnlyDto = null)
|
private async Task<Dictionary<string, string>> CreatePlaceholders(string? accessCode = null, EnvelopeReceiverDto? envelopeReceiverDto = null)
|
||||||
{
|
{
|
||||||
if (accessCode is not null)
|
if (accessCode is not null)
|
||||||
_placeholders["[DOCUMENT_ACCESS_CODE]"] = accessCode;
|
_placeholders["[DOCUMENT_ACCESS_CODE]"] = accessCode;
|
||||||
@ -64,9 +64,9 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
return _placeholders;
|
return _placeholders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DataResult<int>> SendAccessCodeAsync(EnvelopeReceiverDto dto) => await SendAsync(dto: dto, tempType: Constants.EmailTemplateType.DocumentAccessCodeReceived);
|
public async Task<DataResult<int>> SendAccessCodeAsync(EnvelopeReceiverDto dto) => await SendAsync(dto: dto, tempType: EmailTemplateType.DocumentAccessCodeReceived);
|
||||||
|
|
||||||
public async Task<DataResult<int>> SendAsync(EnvelopeReceiverDto dto, Constants.EmailTemplateType tempType)
|
public async Task<DataResult<int>> SendAsync(EnvelopeReceiverDto dto, EmailTemplateType tempType)
|
||||||
{
|
{
|
||||||
var tempSerResult = await _tempService.ReadByNameAsync(tempType);
|
var tempSerResult = await _tempService.ReadByNameAsync(tempType);
|
||||||
if (tempSerResult.IsFailed)
|
if (tempSerResult.IsFailed)
|
||||||
@ -111,7 +111,7 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
|
|
||||||
public async Task<DataResult<int>> SendAsync(EnvelopeReceiverReadOnlyDto dto)
|
public async Task<DataResult<int>> SendAsync(EnvelopeReceiverReadOnlyDto dto)
|
||||||
{
|
{
|
||||||
var tempSerResult = await _tempService.ReadByNameAsync(Constants.EmailTemplateType.DocumentShared);
|
var tempSerResult = await _tempService.ReadByNameAsync(EmailTemplateType.DocumentShared);
|
||||||
if (tempSerResult.IsFailed)
|
if (tempSerResult.IsFailed)
|
||||||
return tempSerResult.ToFail<int>().Notice(LogLevel.Error, Flag.DataIntegrityIssue, $"The email cannot send because '{Constants.EmailTemplateType.DocumentShared}' template cannot found.");
|
return tempSerResult.ToFail<int>().Notice(LogLevel.Error, Flag.DataIntegrityIssue, $"The email cannot send because '{Constants.EmailTemplateType.DocumentShared}' template cannot found.");
|
||||||
var temp = tempSerResult.Data;
|
var temp = tempSerResult.Data;
|
||||||
|
|||||||
@ -99,6 +99,7 @@
|
|||||||
DocumentCompleted
|
DocumentCompleted
|
||||||
DocumentAccessCodeReceived
|
DocumentAccessCodeReceived
|
||||||
DocumentShared
|
DocumentShared
|
||||||
|
TotpSecret
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
Public Enum EncodeType
|
Public Enum EncodeType
|
||||||
|
|||||||
@ -239,7 +239,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
rcv.TotpExpiration = DateTime.Now.AddMonths(1);
|
rcv.TotpExpiration = DateTime.Now.AddMonths(1);
|
||||||
await _rcvService.UpdateAsync(rcv);
|
await _rcvService.UpdateAsync(rcv);
|
||||||
var totp_qr_64 = _codeGenerator.GenerateTotpQrCode(userEmail: rcv.EmailAddress, secretKey: rcv.TotpSecretkey).ToBase64String();
|
var totp_qr_64 = _codeGenerator.GenerateTotpQrCode(userEmail: rcv.EmailAddress, secretKey: rcv.TotpSecretkey).ToBase64String();
|
||||||
// send by email
|
await _mailService.SendAsync(er_secret, EmailTemplateType.TotpSecret);
|
||||||
}
|
}
|
||||||
return await TFAView(auth.UserSelectSMS);
|
return await TFAView(auth.UserSelectSMS);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user