refactor(HomeController): renamed authentication methods with Handle prefix for clarity
This commit is contained in:
parent
7f26bb4766
commit
84e3e4e18d
@ -200,7 +200,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
private async Task<IActionResult?> AccessCodeViewAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
private async Task<IActionResult?> HandleAccessCodeAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
//check the access code verification
|
//check the access code verification
|
||||||
if (er_secret.AccessCode != auth.AccessCode)
|
if (er_secret.AccessCode != auth.AccessCode)
|
||||||
@ -232,7 +232,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
private async Task<IActionResult?> SmsViewAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
private async Task<IActionResult?> HandleSmsAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
if (er_secret.Receiver!.TotpSecretkey is null)
|
if (er_secret.Receiver!.TotpSecretkey is null)
|
||||||
throw new InvalidOperationException($"TotpSecretkey of DTO cannot validate without TotpSecretkey. Dto: {JsonConvert.SerializeObject(er_secret)}");
|
throw new InvalidOperationException($"TotpSecretkey of DTO cannot validate without TotpSecretkey. Dto: {JsonConvert.SerializeObject(er_secret)}");
|
||||||
@ -248,7 +248,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
private async Task<IActionResult?> AuthenticatorViewAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
private async Task<IActionResult?> HandleAuthenticatorAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
if (er_secret.Receiver!.IsTotpInvalid(totp: auth.AuthenticatorCode!))
|
if (er_secret.Receiver!.IsTotpInvalid(totp: auth.AuthenticatorCode!))
|
||||||
{
|
{
|
||||||
@ -298,13 +298,13 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
.WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value);
|
.WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value);
|
||||||
}
|
}
|
||||||
else if (auth.HasAccessCode)
|
else if (auth.HasAccessCode)
|
||||||
if(await AccessCodeViewAsync(auth, er_secret, envelopeReceiverId) is IActionResult acView)
|
if(await HandleAccessCodeAsync(auth, er_secret, envelopeReceiverId) is IActionResult acView)
|
||||||
return acView;
|
return acView;
|
||||||
else if (auth.HasSmsCode)
|
else if (auth.HasSmsCode)
|
||||||
if(await SmsViewAsync(auth, er_secret, envelopeReceiverId) is IActionResult smsView)
|
if(await HandleSmsAsync(auth, er_secret, envelopeReceiverId) is IActionResult smsView)
|
||||||
return smsView;
|
return smsView;
|
||||||
else if (auth.HasAuthenticatorCode)
|
else if (auth.HasAuthenticatorCode)
|
||||||
if(await AuthenticatorViewAsync(auth, er_secret, envelopeReceiverId) is IActionResult aView)
|
if(await HandleAuthenticatorAsync(auth, er_secret, envelopeReceiverId) is IActionResult aView)
|
||||||
return aView;
|
return aView;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user