1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-13 00:28:10 -05:00

implement new eventing system

This commit is contained in:
RaidMax
2023-04-05 09:54:57 -05:00
parent 53a6ef2ec3
commit ebe69a94ad
39 changed files with 1410 additions and 526 deletions

View File

@ -7,6 +7,7 @@ using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using SharedLibraryCore.Events.Management;
using SharedLibraryCore.Helpers;
namespace WebfrontCore.Controllers
@ -72,6 +73,16 @@ namespace WebfrontCore.Controllers
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress?.ToString()
});
Manager.QueueEvent(new LoginEvent
{
Source = this,
LoginSource = LoginEvent.LoginSourceType.Webfront,
EntityId = privilegedClient.ClientId.ToString(),
Identifier = HttpContext.Request.Headers.ContainsKey("X-Forwarded-For")
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress?.ToString()
});
return Ok(Localization["WEBFRONT_ACTION_LOGIN_SUCCESS"].FormatExt(privilegedClient.CleanedName));
}
@ -99,6 +110,16 @@ namespace WebfrontCore.Controllers
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress?.ToString()
});
Manager.QueueEvent(new LogoutEvent
{
Source = this,
LoginSource = LoginEvent.LoginSourceType.Webfront,
EntityId = Client.ClientId.ToString(),
Identifier = HttpContext.Request.Headers.ContainsKey("X-Forwarded-For")
? HttpContext.Request.Headers["X-Forwarded-For"].ToString()
: HttpContext.Connection.RemoteIpAddress?.ToString()
});
}
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);