fix accidental improper name for login ClientId
added label field to InputInfo added logout button revert graph color
This commit is contained in:
parent
6d8d021b16
commit
b6f490be9c
@ -9,16 +9,16 @@ namespace WebfrontCore.Controllers
|
|||||||
public class AccountController : BaseController
|
public class AccountController : BaseController
|
||||||
{
|
{
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> Login(int userId, string password)
|
public async Task<IActionResult> LoginAsync(int clientId, string password)
|
||||||
{
|
{
|
||||||
if (userId == 0 || string.IsNullOrEmpty(password))
|
if (clientId == 0 || string.IsNullOrEmpty(password))
|
||||||
{
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
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));
|
string[] hashedPassword = await Task.FromResult(SharedLibrary.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||||
|
|
||||||
if (hashedPassword[0] == client.Password)
|
if (hashedPassword[0] == client.Password)
|
||||||
@ -51,5 +51,12 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> LogoutAsync()
|
||||||
|
{
|
||||||
|
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
return RedirectToAction("Index", "Home");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,23 +82,25 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
new InputInfo()
|
new InputInfo()
|
||||||
{
|
{
|
||||||
Name = "User ID"
|
Name = "clientId",
|
||||||
|
Label = "Client ID"
|
||||||
},
|
},
|
||||||
new InputInfo()
|
new InputInfo()
|
||||||
{
|
{
|
||||||
Name = "Password",
|
Name = "Password",
|
||||||
|
Label ="Password",
|
||||||
Type = "password",
|
Type = "password",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Action = "Login"
|
Action = "LoginAsync"
|
||||||
};
|
};
|
||||||
|
|
||||||
return View("_ActionForm", login);
|
return View("_ActionForm", login);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Login(int userId, string password)
|
public async Task<IActionResult> LoginAsync(int clientId, string password)
|
||||||
{
|
{
|
||||||
return RedirectToAction("Login", "Account", new { userId, password });
|
return await Task.FromResult(RedirectToAction("LoginAsync", "Account", new { clientId, password }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ namespace WebfrontCore.ViewModels
|
|||||||
public class InputInfo
|
public class InputInfo
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public string Label { get; set; }
|
||||||
public string Placeholder { get; set; }
|
public string Placeholder { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
|
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text" id="basic-addon-@input.Name">@input.Name</span>
|
<span class="input-group-text" id="basic-addon-@input.Name">@input.Label</span>
|
||||||
</div>
|
</div>
|
||||||
@{
|
@{
|
||||||
string inputType = input.Type ?? "text";
|
string inputType = input.Type ?? "text";
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
<div id="console_command_response" class="bg-dark p-3">
|
<div id="console_command_response" class="bg-dark p-3">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col-12 col-sm-9 pr-1 pr-md-0">
|
<div class="col-12 col-sm-9 pr-1 pr-sm-0">
|
||||||
<input id="console_command_value" class="form-control m-0 bg-dark text-light" type="text" />
|
<input id="console_command_value" class="form-control m-0 bg-dark text-light" type="text" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col pl-1 pl-md-0">
|
<div class="col pl-1 pl-sm-0">
|
||||||
<button id="console_command_button" class="btn btn-primary btn-block m-0">Execute</button>
|
<button id="console_command_button" class="btn btn-primary btn-block m-0">Execute</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,17 +35,20 @@
|
|||||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Admins", "PrivilegedAsync", "Client", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center text-md-left">@Html.ActionLink("Admins", "PrivilegedAsync", "Client", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Console", "Index", "Console", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center text-md-left">@Html.ActionLink("Console", "Index", "Console", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
@if (!string.IsNullOrEmpty(ViewBag.DiscordLink))
|
@if (!string.IsNullOrEmpty(ViewBag.DiscordLink))
|
||||||
{
|
{
|
||||||
<li class="nav-item text-center text-md-left"><a href="@ViewBag.DiscordLink" class="nav-link" target="_blank">Discord</a></li>
|
<li class="nav-item text-center text-md-left"><a href="@ViewBag.DiscordLink" class="nav-link" target="_blank">Discord</a></li>
|
||||||
}
|
}
|
||||||
@if (ViewBag.Authorized)
|
@if (ViewBag.Authorized)
|
||||||
{
|
{
|
||||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("", "ProfileAsync", "Client", new { id = ViewBag.User.ClientId }, new { @class = "nav-link oi oi-person oi-fix-navbar w-100", title = "Client Profile" })</li>
|
<li class="nav-item text-center text-md-left">@Html.ActionLink("Logout", "LogoutAsync", "Account", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
}
|
<li class="nav-item text-center text-md-left">@Html.ActionLink("", "ProfileAsync", "Client", new { id = ViewBag.User.ClientId }, new { @class = "nav-link oi oi-person oi-fix-navbar w-100", title = "Client Profile" })</li>
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
<li class="nav-item text-center text-md-left"><a href="#" id="profile_action_login_btn" class="nav-link profile-action oi oi-key oi-fix-navbar w-100" title="Login" data-action="login" aria-hidden="true"></a></li>
|
{
|
||||||
}
|
<li class="nav-item text-center text-md-left">
|
||||||
|
<a href="#" id="profile_action_login_btn" class="nav-link profile-action oi oi-key oi-fix-navbar w-100" title="Login" data-action="login" aria-hidden="true"></a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<form class="form-inline text-primary pt-3 pb-3" method="get" action="/Client/FindAsync">
|
<form class="form-inline text-primary pt-3 pb-3" method="get" action="/Client/FindAsync">
|
||||||
<input id="client_search" name="clientName" class="form-control mr-auto ml-auto mr-md-2" type="text" placeholder="Find Player" />
|
<input id="client_search" name="clientName" class="form-control mr-auto ml-auto mr-md-2" type="text" placeholder="Find Player" />
|
||||||
|
@ -53,7 +53,7 @@ var charts = {};
|
|||||||
$('.server-history-row').each(function (index, element) {
|
$('.server-history-row').each(function (index, element) {
|
||||||
let clientHistory = $(this).data('clienthistory');
|
let clientHistory = $(this).data('clienthistory');
|
||||||
let serverId = $(this).data('serverid');
|
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 width = $('.server-header').first().width();
|
||||||
let historyChart = getPlayerHistoryChart(clientHistory, serverId, width, color);
|
let historyChart = getPlayerHistoryChart(clientHistory, serverId, width, color);
|
||||||
historyChart.render();
|
historyChart.render();
|
||||||
|
Loading…
Reference in New Issue
Block a user