fix damage event not including log line
complete initiall implementation for "2FA" issue #52 issue #66
This commit is contained in:
@ -21,9 +21,11 @@ namespace WebfrontCore.Controllers
|
||||
try
|
||||
{
|
||||
var client = Manager.GetPrivilegedClients()[clientId];
|
||||
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||
|
||||
if (hashedPassword[0] == client.Password)
|
||||
// string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||
//if (hashedPassword[0] == client.Password)
|
||||
|
||||
if (Manager.TokenAuthenticator.AuthorizeToken(client.NetworkId, password))
|
||||
{
|
||||
var claims = new[]
|
||||
{
|
||||
@ -61,12 +63,5 @@ namespace WebfrontCore.Controllers
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> GenerateLoginTokenAsync()
|
||||
{
|
||||
return Json(new { token = Manager.TokenAuthenticator.GenerateNextToken(Client.NetworkId) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using WebfrontCore.ViewModels;
|
||||
@ -182,5 +183,25 @@ namespace WebfrontCore.Controllers
|
||||
command = $"!setlevel @{targetId} {level}"
|
||||
}));
|
||||
}
|
||||
|
||||
public async Task<IActionResult> GenerateLoginTokenForm()
|
||||
{
|
||||
var info = new ActionInfo()
|
||||
{
|
||||
ActionButtonLabel = "Generate",
|
||||
Name = "GenerateLoginToken",
|
||||
Action = "GenerateLoginTokenAsync",
|
||||
Inputs = new List<InputInfo>()
|
||||
};
|
||||
|
||||
return View("_ActionForm", info);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public string GenerateLoginTokenAsync()
|
||||
{
|
||||
var state = Manager.TokenAuthenticator.GenerateNextToken(Client.NetworkId);
|
||||
return string.Format(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_GENERATETOKEN_SUCCESS"], state.Token, $"{state.RemainingTime} {Utilities.CurrentLocalization.LocalizationIndex["GLOBAL_MINUTES"]}", Client.ClientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user