33 lines
923 B
C#
33 lines
923 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using System.Security.Claims;
|
|
using _0_Framework.Application;
|
|
using AccountManagement.Application.Contracts.Account;
|
|
|
|
namespace ServiceHost.Pages
|
|
{
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly IAuthHelper _authHelper;
|
|
private readonly IAccountApplication _accountApplication;
|
|
|
|
public IndexModel(IAuthHelper authHelper, IAccountApplication accountApplication)
|
|
{
|
|
_authHelper = authHelper;
|
|
_accountApplication = accountApplication;
|
|
}
|
|
|
|
public IActionResult OnGet()
|
|
{
|
|
if(_authHelper.IsAuthenticated())
|
|
return Redirect("/login");
|
|
return Page();
|
|
}
|
|
|
|
public IActionResult OnGetLogout()
|
|
{
|
|
_accountApplication.Logout();
|
|
return RedirectToPage("/Index");
|
|
}
|
|
}
|
|
} |