feat(HomeController): Funktion zur Überprüfung des Authenticator-Codes hinzugefügt.

This commit is contained in:
Developer 02
2024-12-11 18:32:35 +01:00
parent 27db664b4d
commit c41d5c4a76
2 changed files with 10 additions and 2 deletions

View File

@@ -19,7 +19,6 @@ using Ganss.Xss;
using Newtonsoft.Json;
using EnvelopeGenerator.Application.DTOs;
using DigitalData.Core.Client;
using System.Text.Json;
using EnvelopeGenerator.Application.Extensions;
namespace EnvelopeGenerator.Web.Controllers
@@ -257,6 +256,15 @@ namespace EnvelopeGenerator.Web.Controllers
return await TFAView(viaSms: true);
}
}
else if (auth.HasAuthenticatorCode)
{
if (!auth.AuthenticatorCode!.IsValidTotp(er_secret.Receiver!.TotpSecretkey!))
{
Response.StatusCode = StatusCodes.Status401Unauthorized;
ViewData["ErrorMessage"] = _localizer[WebKey.WrongAccessCode].Value;
return await TFAView(viaSms: false);
}
}
else
{
Response.StatusCode = StatusCodes.Status401Unauthorized;