mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-19 19:14:51 +00:00
25 lines
No EOL
733 B
C#
25 lines
No EOL
733 B
C#
#nullable enable
|
|
using LBPUnion.ProjectLighthouse.PlayerData;
|
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
using LBPUnion.ProjectLighthouse.Types;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages;
|
|
|
|
public class LogoutPage : BaseLayout
|
|
{
|
|
public LogoutPage(Database database) : base(database)
|
|
{}
|
|
public async Task<IActionResult> OnGet()
|
|
{
|
|
WebToken? token = this.Database.WebTokenFromRequest(this.Request);
|
|
if (token == null) return this.BadRequest();
|
|
|
|
this.Database.WebTokens.Remove(token);
|
|
await this.Database.SaveChangesAsync();
|
|
|
|
this.Response.Cookies.Delete("LighthouseToken");
|
|
|
|
return this.Page();
|
|
}
|
|
} |