Compare commits
No commits in common. "55054790d29fccd139297cdb60cdd4890f6b6486" and "a1c59d3dd4ab9d7d82dc7a3c0ba507588529ee60" have entirely different histories.
55054790d2
...
a1c59d3dd4
@ -90,7 +90,7 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
var car = _carStorage.GetElement(new CarSearchModel() { Id = model.CarId });
|
var car = _carStorage.GetElement(new CarSearchModel() { Id = model.CarId });
|
||||||
if (car == null)
|
if (car == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Car not found.");
|
_logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Document not found.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (CheckThenSupplyMany(car, model.Count) == false)
|
if (CheckThenSupplyMany(car, model.Count) == false)
|
||||||
|
@ -7,17 +7,8 @@ namespace AutomobilePlantShopApp
|
|||||||
public static class APIClient
|
public static class APIClient
|
||||||
{
|
{
|
||||||
private static readonly HttpClient _client = new();
|
private static readonly HttpClient _client = new();
|
||||||
public static bool isAuth { get; private set; } = false;
|
public static bool isAuth { get; set; } = false;
|
||||||
public static string ConfigPassword { get; private set; } = string.Empty;
|
public static string ConfigPassword { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public static bool Login(string password)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите пароль");
|
|
||||||
}
|
|
||||||
return isAuth = password.Equals(ConfigPassword);
|
|
||||||
}
|
|
||||||
public static void Connect(IConfiguration configuration)
|
public static void Connect(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
ConfigPassword = configuration["Password"];
|
ConfigPassword = configuration["Password"];
|
||||||
|
@ -45,10 +45,15 @@ namespace AutomobilePlantShopApp.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Enter(string password)
|
public void Enter(string password)
|
||||||
{
|
{
|
||||||
if (!APIClient.Login(password))
|
if (string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
throw new Exception("Введите пароль");
|
||||||
|
}
|
||||||
|
if (!password.Equals(APIClient.ConfigPassword))
|
||||||
{
|
{
|
||||||
throw new Exception("Неверный пароль");
|
throw new Exception("Неверный пароль");
|
||||||
}
|
}
|
||||||
|
APIClient.isAuth = true;
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Index");
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user