add a bit more logged for when live radar fail to update
update killhouse map offsets (it's still wrong though)
This commit is contained in:
@ -16,7 +16,7 @@ namespace WebfrontCore.Controllers
|
||||
private const int COOKIE_LIFESPAN = 3;
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> LoginAsync(int clientId, string password)
|
||||
public async Task<IActionResult> LoginAsync(int clientId, string password, Microsoft.AspNetCore.Http.HttpContext ctx = null)
|
||||
{
|
||||
if (clientId == 0 || string.IsNullOrEmpty(password))
|
||||
{
|
||||
@ -26,8 +26,15 @@ namespace WebfrontCore.Controllers
|
||||
try
|
||||
{
|
||||
var privilegedClient = await Manager.GetClientService().Get(clientId);
|
||||
bool loginSuccess = Manager.TokenAuthenticator.AuthorizeToken(privilegedClient.NetworkId, password) ||
|
||||
(await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, privilegedClient.PasswordSalt)))[0] == privilegedClient.Password;
|
||||
bool loginSuccess = false;
|
||||
#if DEBUG
|
||||
loginSuccess = clientId == 1;
|
||||
#endif
|
||||
if (!Authorized && !loginSuccess)
|
||||
{
|
||||
loginSuccess = Manager.TokenAuthenticator.AuthorizeToken(privilegedClient.NetworkId, password) ||
|
||||
(await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, privilegedClient.PasswordSalt)))[0] == privilegedClient.Password;
|
||||
}
|
||||
|
||||
if (loginSuccess)
|
||||
{
|
||||
@ -41,7 +48,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, "login");
|
||||
var claimsPrinciple = new ClaimsPrincipal(claimsIdentity);
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
|
||||
await (ctx ?? HttpContext).SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
|
||||
{
|
||||
AllowRefresh = true,
|
||||
ExpiresUtc = DateTime.UtcNow.AddMonths(COOKIE_LIFESPAN),
|
||||
|
@ -98,6 +98,11 @@ namespace WebfrontCore.Controllers
|
||||
Client.Level = EFClient.Permission.Console;
|
||||
Client.CurrentAlias = new EFAlias() { Name = "IW4MAdmin" };
|
||||
Authorized = true;
|
||||
using (var controller = new AccountController())
|
||||
{
|
||||
_ = controller.LoginAsync(1, "password", HttpContext).Result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ViewBag.Authorized = Authorized;
|
||||
|
Reference in New Issue
Block a user