ShowRecoveryCodes.cshtml.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. #nullable disable
  4. using Microsoft.AspNetCore.Identity;
  5. using Microsoft.AspNetCore.Mvc;
  6. using Microsoft.AspNetCore.Mvc.RazorPages;
  7. using Microsoft.Extensions.Logging;
  8. namespace bitforum.Areas.Identity.Pages.Account.Manage
  9. {
  10. /// <summary>
  11. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  12. /// directly from your code. This API may change or be removed in future releases.
  13. /// </summary>
  14. public class ShowRecoveryCodesModel : PageModel
  15. {
  16. /// <summary>
  17. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  18. /// directly from your code. This API may change or be removed in future releases.
  19. /// </summary>
  20. [TempData]
  21. public string[] RecoveryCodes { get; set; }
  22. /// <summary>
  23. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  24. /// directly from your code. This API may change or be removed in future releases.
  25. /// </summary>
  26. [TempData]
  27. public string StatusMessage { get; set; }
  28. /// <summary>
  29. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  30. /// directly from your code. This API may change or be removed in future releases.
  31. /// </summary>
  32. public IActionResult OnGet()
  33. {
  34. if (RecoveryCodes == null || RecoveryCodes.Length == 0)
  35. {
  36. return RedirectToPage("./TwoFactorAuthentication");
  37. }
  38. return Page();
  39. }
  40. }
  41. }