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
|
||||
if (er_secret.TFAEnabled)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
return await TFAView(auth.UserSelectSMS);
|
||||
}
|
||||
else if (auth.HasSmsCode)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
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;
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
@using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
@using Newtonsoft.Json
|
||||
@model Auth;
|
||||
@{
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var logo = _logoOpt.Value;
|
||||
ViewData["Title"] = _localizer[WebKey.DocProtected];
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
string accessCodeName = ViewData["AccessCodeName"] is string _accessCodeName ? _accessCodeName : "accessCode";
|
||||
string codePropName = char.ToUpper(accessCodeName[0]) + accessCodeName.Substring(1);
|
||||
bool viaSms = accessCodeName == "smsCode";
|
||||
bool viaAuthenticator = accessCodeName == "authenticatorCode";
|
||||
bool viaTFA = viaSms || viaAuthenticator;
|
||||
@ -44,7 +46,14 @@
|
||||
@if (tfaEnabled)
|
||||
{
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user