Skip to content

Commit c128164

Browse files
guardrexhalter73
andauthored
Apply suggestions from code review
Co-authored-by: Stephen Halter <[email protected]>
1 parent 6060ce8 commit c128164

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

aspnetcore/blazor/security/webassembly/standalone-with-identity/account-confirmation-and-password-recovery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ In the client project, add the following `ForgotPassword` component.
362362
Obtain the code from the email for this form.
363363
</div>
364364
<EditForm Model="Reset" FormName="reset-password"
365-
OnValidSubmit="OnValidSubmitStep2Async" method="post">
365+
OnValidSubmit="OnValidSubmitStep2Async" method="post">
366366
<DataAnnotationsValidator />
367367
<ValidationSummary class="text-danger" role="alert" />
368368

aspnetcore/blazor/security/webassembly/standalone-with-identity/qrcodes-for-authenticator-apps.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ Replace the `Login` component. The following version of the `Login` component:
480480
{
481481
if (!string.IsNullOrEmpty(Input.TwoFactorCode))
482482
{
483+
// The [RegularExpression] data annotation ensures that the input will be either a six-digit
484+
// authenticator code (######) or eleven-character alphanumeric recovery code (#####-#####)
483485
if (Input.TwoFactorCode.Length == 6)
484486
{
485487
formResult = await Acct.LoginTwoFactorCodeAsync(
@@ -505,7 +507,10 @@ Replace the `Login` component. The following version of the `Login` component:
505507
formResult = await Acct.LoginAsync(Input.Email, Input.Password);
506508
requiresTwoFactor = formResult.ErrorList.Contains("RequiresTwoFactor");
507509
Input.TwoFactorCode = string.Empty;
508-
formResult.ErrorList = [];
510+
if (requiresTwoFactor)
511+
{
512+
formResult.ErrorList = [];
513+
}
509514
}
510515
511516
if (formResult.Succeeded && !string.IsNullOrEmpty(ReturnUrl))
@@ -526,13 +531,12 @@ Replace the `Login` component. The following version of the `Login` component:
526531
[Display(Name = "Password")]
527532
public string Password { get; set; } = string.Empty;
528533
529-
[Required]
530534
[RegularExpression(@"^([0-9]{6})|([A-Z0-9]{5}[-]{1}[A-Z0-9]{5})$",
531535
ErrorMessage = "Must be a six-digit authenticator code (######) or " +
532536
"eleven-character alphanumeric recovery code (#####-#####, dash " +
533537
"required)")]
534-
[Display(Name = "Two-factor code")]
535-
public string TwoFactorCode { get; set; } = "123456";
538+
[Display(Name = "Two-factor Code or Recovery Code")]
539+
public string TwoFactorOrRecoveryCode { get; set; } = string.Empty;
536540
}
537541
}
538542
```

0 commit comments

Comments
 (0)