diff --git a/WebfrontCore/Controllers/AccountController.cs b/WebfrontCore/Controllers/AccountController.cs index 7921510a9..218258560 100644 --- a/WebfrontCore/Controllers/AccountController.cs +++ b/WebfrontCore/Controllers/AccountController.cs @@ -9,16 +9,16 @@ namespace WebfrontCore.Controllers public class AccountController : BaseController { [HttpGet] - public async Task Login(int userId, string password) + public async Task LoginAsync(int clientId, string password) { - if (userId == 0 || string.IsNullOrEmpty(password)) + if (clientId == 0 || string.IsNullOrEmpty(password)) { return Unauthorized(); } try { - var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[userId]; + var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[clientId]; string[] hashedPassword = await Task.FromResult(SharedLibrary.Helpers.Hashing.Hash(password, client.PasswordSalt)); if (hashedPassword[0] == client.Password) @@ -51,5 +51,12 @@ namespace WebfrontCore.Controllers return Unauthorized(); } + + [HttpGet] + public async Task LogoutAsync() + { + await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + return RedirectToAction("Index", "Home"); + } } } diff --git a/WebfrontCore/Controllers/ActionController.cs b/WebfrontCore/Controllers/ActionController.cs index 286c23a9d..b4886f761 100644 --- a/WebfrontCore/Controllers/ActionController.cs +++ b/WebfrontCore/Controllers/ActionController.cs @@ -82,23 +82,25 @@ namespace WebfrontCore.Controllers { new InputInfo() { - Name = "User ID" + Name = "clientId", + Label = "Client ID" }, new InputInfo() { Name = "Password", + Label ="Password", Type = "password", } }, - Action = "Login" + Action = "LoginAsync" }; return View("_ActionForm", login); } - public IActionResult Login(int userId, string password) + public async Task LoginAsync(int clientId, string password) { - return RedirectToAction("Login", "Account", new { userId, password }); + return await Task.FromResult(RedirectToAction("LoginAsync", "Account", new { clientId, password })); } } } diff --git a/WebfrontCore/ViewModels/InputInfo.cs b/WebfrontCore/ViewModels/InputInfo.cs index c4b4b7436..ac2d75f55 100644 --- a/WebfrontCore/ViewModels/InputInfo.cs +++ b/WebfrontCore/ViewModels/InputInfo.cs @@ -8,6 +8,7 @@ namespace WebfrontCore.ViewModels public class InputInfo { public string Name { get; set; } + public string Label { get; set; } public string Placeholder { get; set; } public string Type { get; set; } public string Value { get; set; } diff --git a/WebfrontCore/Views/Action/_ActionForm.cshtml b/WebfrontCore/Views/Action/_ActionForm.cshtml index 83dafc70d..4bb28b798 100644 --- a/WebfrontCore/Views/Action/_ActionForm.cshtml +++ b/WebfrontCore/Views/Action/_ActionForm.cshtml @@ -8,7 +8,7 @@
- @input.Name + @input.Label
@{ string inputType = input.Type ?? "text"; diff --git a/WebfrontCore/Views/Console/Index.cshtml b/WebfrontCore/Views/Console/Index.cshtml index 7c80bb625..63d68a853 100644 --- a/WebfrontCore/Views/Console/Index.cshtml +++ b/WebfrontCore/Views/Console/Index.cshtml @@ -6,10 +6,10 @@
-
+
-
+
diff --git a/WebfrontCore/Views/Shared/_Layout.cshtml b/WebfrontCore/Views/Shared/_Layout.cshtml index ca0a40a9a..8c7226e8d 100644 --- a/WebfrontCore/Views/Shared/_Layout.cshtml +++ b/WebfrontCore/Views/Shared/_Layout.cshtml @@ -35,17 +35,20 @@ @if (!string.IsNullOrEmpty(ViewBag.DiscordLink)) - { - - } + { + +} @if (ViewBag.Authorized) - { - - } - else - { - - } + { + + +} +else +{ + +}
diff --git a/WebfrontCore/wwwroot/js/server.js b/WebfrontCore/wwwroot/js/server.js index 2fd4c1bdb..2aeb04f46 100644 --- a/WebfrontCore/wwwroot/js/server.js +++ b/WebfrontCore/wwwroot/js/server.js @@ -53,7 +53,7 @@ var charts = {}; $('.server-history-row').each(function (index, element) { let clientHistory = $(this).data('clienthistory'); let serverId = $(this).data('serverid'); - let color = $(this).data('online') === 'True' ? '#007acc' : '#ff6060' + let color = $(this).data('online') === 'True' ? 'rgba(0, 122, 204, 0.432)' : '#ff6060' let width = $('.server-header').first().width(); let historyChart = getPlayerHistoryChart(clientHistory, serverId, width, color); historyChart.render();