mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-18 00:18:17 +02:00
21 lines
746 B
C#
21 lines
746 B
C#
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
using Microsoft.AspNetCore.Authentication;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using MTWireGuard.Application.Repositories;
|
|
|
|
namespace MTWireGuard.Pages
|
|
{
|
|
public class LogoutModel(IMikrotikRepository api) : PageModel
|
|
{
|
|
public async Task<IActionResult> OnGetAsync(string returnUrl = "Login")
|
|
{
|
|
// Clear the existing external cookie
|
|
await HttpContext.SignOutAsync(
|
|
CookieAuthenticationDefaults.AuthenticationScheme);
|
|
var sessionId = await api.GetCurrentSessionID();
|
|
var kill = await api.KillJob(sessionId);
|
|
return RedirectToPage(returnUrl);
|
|
}
|
|
}
|
|
}
|