feat(EnvelopeLocked): Unterstützung für TFA-Registrierungsfrist auf der gesperrten Seite hinzufügen

- Einführung der TFA-Registrierungsfrist, um einen Link zur Einrichtung der Authenticator-App innerhalb eines gültigen Zeitfensters anzuzeigen.
- Aktualisierung der Ansicht, um die Registrierungsfrist anzuzeigen, falls zutreffend, und den Benutzer zur Einrichtung von TFA zu leiten.
This commit is contained in:
Developer 02
2025-02-06 18:39:32 +01:00
parent 1720e137f9
commit 6d6e62c8d0
2 changed files with 6 additions and 2 deletions

View File

@@ -171,7 +171,10 @@ public class HomeController : ViewControllerBase
} }
else else
{ {
return View("EnvelopeLocked").WithData("CodeType", "authenticatorCode").WithData("QRCodeExpiration", er_secret.Receiver?.TotpExpiration); return View("EnvelopeLocked")
.WithData("CodeType", "authenticatorCode")
.WithData("QRCodeExpiration", er_secret.Receiver?.TotpExpiration)
.WithData("TfaRegDeadline", er_secret.Receiver?.TfaRegDeadline);
} }
} }

View File

@@ -16,6 +16,7 @@
bool tfaEnabled = ViewData["TFAEnabled"] is bool _tfaEnabled && _tfaEnabled; bool tfaEnabled = ViewData["TFAEnabled"] is bool _tfaEnabled && _tfaEnabled;
bool hasPhoneNumber = ViewData["HasPhoneNumber"] is bool _hasPhoneNumber && _hasPhoneNumber; bool hasPhoneNumber = ViewData["HasPhoneNumber"] is bool _hasPhoneNumber && _hasPhoneNumber;
var envelopeKey = ViewData["EnvelopeKey"] as string; var envelopeKey = ViewData["EnvelopeKey"] as string;
DateTime? tfaRegDeadline = ViewData["TfaRegDeadline"] is DateTime _deadline ? _deadline : null;
} }
<div class="page container py-4 px-4"> <div class="page container py-4 px-4">
<header class="text-center"> <header class="text-center">
@@ -31,7 +32,7 @@
</div> </div>
<h1>@_localizer[WebKey.Formats.LockedTitle.Format(codeKeyName)]</h1> <h1>@_localizer[WebKey.Formats.LockedTitle.Format(codeKeyName)]</h1>
</header> </header>
@if (viaAuthenticator) @if (tfaRegDeadline is not null && tfaRegDeadline > DateTime.Now)
{ {
<section class="text-center"> <section class="text-center">
<p class="m-0 p-0"> <p class="m-0 p-0">