mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-14 22:02:26 +00:00
Refactor Database into DatabaseContext Moved into separate folder so it actually has a namespace instead sitting in the root
32 lines
No EOL
916 B
C#
32 lines
No EOL
916 B
C#
#nullable enable
|
|
using System.Net;
|
|
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.ExternalAuth;
|
|
|
|
public class AuthenticationPage : BaseLayout
|
|
{
|
|
|
|
public List<PlatformLinkAttempt> LinkAttempts = new();
|
|
|
|
public IPAddress? IpAddress;
|
|
public AuthenticationPage(DatabaseContext database) : base(database)
|
|
{}
|
|
|
|
public IActionResult OnGet()
|
|
{
|
|
if (this.User == null) return this.StatusCode(403, "");
|
|
|
|
this.IpAddress = this.HttpContext.Connection.RemoteIpAddress;
|
|
|
|
this.LinkAttempts = this.Database.PlatformLinkAttempts
|
|
.Where(l => l.UserId == this.User.UserId)
|
|
.OrderByDescending(a => a.Timestamp)
|
|
.ToList();
|
|
|
|
return this.Page();
|
|
}
|
|
} |