mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-18 00:18:17 +02:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
using Microsoft.AspNetCore.Authentication;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using System.Net;
|
|
using System.Security.Claims;
|
|
using System.Text;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using MTWireGuard.Application.Repositories;
|
|
using MTWireGuard.Application.Models.Requests;
|
|
using MTWireGuard.Application.Models.Mikrotik;
|
|
using MTWireGuard.Application;
|
|
|
|
namespace MTWireGuard.Pages
|
|
{
|
|
[IgnoreAntiforgeryToken(Order = 1001)]
|
|
[AllowAnonymous]
|
|
public class LoginModel : PageModel
|
|
{
|
|
public IActionResult OnGet(string ReturnUrl = "Index")
|
|
{
|
|
var user = HttpContext.Session.Get<WGPeerViewModel>("user");
|
|
if (user != null)
|
|
{
|
|
return RedirectPermanent("/Client");
|
|
}
|
|
if (HttpContext.User.Identity.IsAuthenticated)
|
|
{
|
|
ReturnUrl = ReturnUrl == "/" ? "Index" : ReturnUrl;
|
|
return RedirectToPage(ReturnUrl);
|
|
}
|
|
return Page();
|
|
}
|
|
}
|
|
}
|