fix accidental improper name for login ClientId
added label field to InputInfo added logout button revert graph color
This commit is contained in:
@ -9,16 +9,16 @@ namespace WebfrontCore.Controllers
|
||||
public class AccountController : BaseController
|
||||
{
|
||||
[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();
|
||||
}
|
||||
|
||||
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<IActionResult> LogoutAsync()
|
||||
{
|
||||
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<IActionResult> LoginAsync(int clientId, string password)
|
||||
{
|
||||
return RedirectToAction("Login", "Account", new { userId, password });
|
||||
return await Task.FromResult(RedirectToAction("LoginAsync", "Account", new { clientId, password }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user