in Application/UI/Blazor/ImageRecognition/Areas/Identity/Pages/Account/ConfirmAccount.cshtml.cs [34:52]
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (ModelState.IsValid)
{
var userId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
var user = await _userManager.FindByIdAsync(userId);
if (user == null) return NotFound($"Unable to load user with ID '{userId}'.");
var result = await _userManager.ConfirmSignUpAsync(user, Input.Code, true);
if (!result.Succeeded)
throw new InvalidOperationException($"Error confirming account for user with ID '{userId}':");
return RedirectToPage("./Login");
}
// If we got this far, something failed, redisplay form
return Page();
}