2024-02-25 14:16:55 +00:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-02-24 15:00:36 +00:00
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
2024-02-25 14:16:55 +00:00
|
|
|
using OliverBooth.Services;
|
2024-02-24 15:00:36 +00:00
|
|
|
|
|
|
|
namespace OliverBooth.Pages.Admin;
|
|
|
|
|
|
|
|
public class Login : PageModel
|
|
|
|
{
|
2024-02-25 14:16:55 +00:00
|
|
|
private readonly ISessionService _sessionService;
|
|
|
|
|
|
|
|
public Login(ISessionService sessionService)
|
|
|
|
{
|
|
|
|
_sessionService = sessionService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IActionResult OnGet()
|
2024-02-24 15:00:36 +00:00
|
|
|
{
|
2024-02-25 14:16:55 +00:00
|
|
|
return _sessionService.TryGetCurrentUser(Request, Response, out _) ? RedirectToPage("/admin/index") : Page();
|
2024-02-24 15:00:36 +00:00
|
|
|
}
|
|
|
|
}
|