oliverbooth.dev/OliverBooth/Pages/Admin/MultiFactorStep.cshtml.cs

28 lines
778 B
C#
Raw Normal View History

2024-02-25 17:21:29 +00:00
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using OliverBooth.Common.Services;
2024-02-25 17:21:29 +00:00
namespace OliverBooth.Pages.Admin;
public class MultiFactorStep : PageModel
{
private readonly ISessionService _sessionService;
public MultiFactorStep(ISessionService sessionService)
{
_sessionService = sessionService;
}
public string Token { get; private set; } = string.Empty;
public int? Result { get; private set; }
public IActionResult OnGet([FromQuery(Name = "token")] string token,
[FromQuery(Name = "result")] int? result = null)
{
Token = token;
Result = result;
return _sessionService.TryGetCurrentUser(Request, Response, out _) ? RedirectToPage("/admin/index") : Page();
}
}