refactor(EnvelopeReceiver): TFAEnabled wurde in die Envelope-Tabelle für Entität und DTO verschoben.

- Aktualisierte zugehörige Felder in HomeController.
This commit is contained in:
Developer 02 2025-01-24 18:13:29 +01:00
parent 713c2f3ed2
commit 867756242e
5 changed files with 9 additions and 9 deletions

View File

@ -51,6 +51,8 @@ namespace EnvelopeGenerator.Application.DTOs
public int? ExpiresWarningWhenDays { get; set; }
public bool TFAEnabled { get; init; }
public bool DmzMoved { get; set; }
public UserReadDto? User { get; set; }
public EnvelopeType? EnvelopeType { get; set; }

View File

@ -27,7 +27,5 @@ namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
public DateTime? ChangedWhen { get; init; }
public bool HasPhoneNumber { get; init; }
public bool TFAEnabled { get; init; }
}
}

View File

@ -84,6 +84,9 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("EXPIRES_WARNING_WHEN_DAYS")]
public int? ExpiresWarningWhenDays { get; set; }
[Column("TFA_ENABLED", TypeName = "bit")]
public bool TFAEnabled { get; set; }
/// <summary>
/// The sender of envelope
/// </summary>

View File

@ -46,9 +46,6 @@ namespace EnvelopeGenerator.Domain.Entities
[RegularExpression(@"^\+[0-9]+$", ErrorMessage = "Phone number must start with '+' followed by digits.")]
public string? PhoneNumber { get; set; }
[Column("TFA_ENABLED", TypeName = "bit")]
public bool TFAEnabled { get; set; }
[NotMapped]
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);

View File

@ -146,7 +146,7 @@ namespace EnvelopeGenerator.Web.Controllers
return await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId).ThenAsync(
Success: er => View()
.WithData("EnvelopeKey", envelopeReceiverId)
.WithData("TFAEnabled", er.TFAEnabled)
.WithData("TFAEnabled", er.Envelope!.TFAEnabled)
.WithData("HasPhoneNumber", er.HasPhoneNumber),
Fail: IActionResult (messages, notices) =>
{
@ -229,7 +229,7 @@ namespace EnvelopeGenerator.Web.Controllers
await _historyService.RecordAsync(er_secret.EnvelopeId, er_secret.Receiver!.EmailAddress, EnvelopeStatus.AccessCodeCorrect);
//check if the user has phone is added
if (er_secret.TFAEnabled)
if (er_secret.Envelope!.TFAEnabled)
{
var rcv = er_secret.Receiver;
if (rcv.IsTotpSecretInvalid())