mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-19 08:58:17 +02:00
Add project files.
This commit is contained in:
commit
b2325a46ef
1351 changed files with 48136 additions and 0 deletions
30
Pages/Logout.cshtml.cs
Normal file
30
Pages/Logout.cshtml.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using MTWireGuard.Repositories;
|
||||
|
||||
namespace MTWireGuard.Pages
|
||||
{
|
||||
public class LogoutModel : PageModel
|
||||
{
|
||||
private readonly IMikrotikRepository API;
|
||||
|
||||
public LogoutModel(IMikrotikRepository mikrotik)
|
||||
{
|
||||
API = mikrotik;
|
||||
}
|
||||
public async Task<IActionResult> OnGetAsync(string returnUrl = "Login")
|
||||
{
|
||||
// Clear the existing external cookie
|
||||
await HttpContext.SignOutAsync(
|
||||
CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
/*
|
||||
var sessionId = await MTAPIHandler.GetCurrentSessionID();
|
||||
var remove = await MTAPIHandler.KillJob(sessionId);*/
|
||||
var sessionId = await API.GetCurrentSessionID();
|
||||
var kill = await API.KillJob(sessionId);
|
||||
return RedirectToPage(returnUrl);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue