fix(EnvelopedLocked): asp-for tag helper verwendet, um die Daten der UserSelectSMS Eigenschaft zu erhalten.
- nullibility und null check von UserSelectSMS entfernt, weil es für tag helper nicht akzeptabel ist
This commit is contained in:
parent
6a6da39bc4
commit
76bd1a102f
@ -226,17 +226,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
|
|
||||||
//check if the user has phone is added
|
//check if the user has phone is added
|
||||||
if (er_secret.TFAEnabled)
|
if (er_secret.TFAEnabled)
|
||||||
{
|
return await TFAView(auth.UserSelectSMS);
|
||||||
if (auth.UserSelectSMS is bool userSelectSMS)
|
|
||||||
return await TFAView(userSelectSMS);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// if If TFA is enabled but UserSelectSMS is null, there is an unauthorized request(e.g. via an application like postman)
|
|
||||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
|
||||||
_logger.LogError("TFA is enabled but UserSelectSMS is null. In this case there is an unauthorized request (for example via an application like postman). Form data: {form}", JsonConvert.SerializeObject(auth));
|
|
||||||
return this.ViewInnerServiceError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (auth.HasSmsCode)
|
else if (auth.HasSmsCode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
namespace EnvelopeGenerator.Web.Models
|
namespace EnvelopeGenerator.Web.Models
|
||||||
{
|
{
|
||||||
public record Auth(string? AccessCode = null, string? SmsCode = null, string? AuthenticatorCode = null, bool? UserSelectSMS = null)
|
public record Auth(string? AccessCode = null, string? SmsCode = null, string? AuthenticatorCode = null, bool UserSelectSMS = default)
|
||||||
{
|
{
|
||||||
public bool HasAccessCode => AccessCode is not null;
|
public bool HasAccessCode => AccessCode is not null;
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
@using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
@using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||||
@using Newtonsoft.Json
|
@using Newtonsoft.Json
|
||||||
|
@model Auth;
|
||||||
@{
|
@{
|
||||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||||
var logo = _logoOpt.Value;
|
var logo = _logoOpt.Value;
|
||||||
ViewData["Title"] = _localizer[WebKey.DocProtected];
|
ViewData["Title"] = _localizer[WebKey.DocProtected];
|
||||||
var userCulture = ViewData["UserCulture"] as Culture;
|
var userCulture = ViewData["UserCulture"] as Culture;
|
||||||
string accessCodeName = ViewData["AccessCodeName"] is string _accessCodeName ? _accessCodeName : "accessCode";
|
string accessCodeName = ViewData["AccessCodeName"] is string _accessCodeName ? _accessCodeName : "accessCode";
|
||||||
|
string codePropName = char.ToUpper(accessCodeName[0]) + accessCodeName.Substring(1);
|
||||||
bool viaSms = accessCodeName == "smsCode";
|
bool viaSms = accessCodeName == "smsCode";
|
||||||
bool viaAuthenticator = accessCodeName == "authenticatorCode";
|
bool viaAuthenticator = accessCodeName == "authenticatorCode";
|
||||||
bool viaTFA = viaSms || viaAuthenticator;
|
bool viaTFA = viaSms || viaAuthenticator;
|
||||||
@ -44,7 +46,14 @@
|
|||||||
@if (tfaEnabled)
|
@if (tfaEnabled)
|
||||||
{
|
{
|
||||||
<div class="form-check form-switch tfa-sms">
|
<div class="form-check form-switch tfa-sms">
|
||||||
<input class="form-check-input" name="userSelectSMS" type="checkbox" role="switch" id="flexSwitchCheckChecked" @(hasPhoneNumber ? string.Empty : "disabled")>
|
@if(hasPhoneNumber)
|
||||||
|
{
|
||||||
|
<input asp-for="UserSelectSMS" class="form-check-input" name="userSelectSMS" type="checkbox" role="switch" id="flexSwitchCheckChecked">
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input asp-for="UserSelectSMS" class="form-check-input" name="userSelectSMS" type="checkbox" role="switch" id="flexSwitchCheckChecked" disabled)>
|
||||||
|
}
|
||||||
<label class="form-check-label" for="flexSwitchCheckChecked">2FA per SMS</label>
|
<label class="form-check-label" for="flexSwitchCheckChecked">2FA per SMS</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user