сдана 5 усложненка
This commit is contained in:
parent
13f8e6683f
commit
165a765693
@ -7,9 +7,8 @@ namespace IceCreamShopApp
|
|||||||
public class APIClient
|
public class APIClient
|
||||||
{
|
{
|
||||||
private static readonly HttpClient _client = new();
|
private static readonly HttpClient _client = new();
|
||||||
public static string Password { get; private set; } = string.Empty;
|
public static string Password = string.Empty;
|
||||||
public static bool Access { get; set; } = false;
|
public static bool Access { get; private set; }
|
||||||
|
|
||||||
public static void Connect(IConfiguration configuration)
|
public static void Connect(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
Password = configuration["PasswordShop"];
|
Password = configuration["PasswordShop"];
|
||||||
@ -45,5 +44,10 @@ namespace IceCreamShopApp
|
|||||||
throw new Exception(result);
|
throw new Exception(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GetAccess(string password)
|
||||||
|
{
|
||||||
|
Access = Password == password;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,9 @@ namespace IceCreamShopApp.Controllers
|
|||||||
{
|
{
|
||||||
throw new Exception("Введите пароль");
|
throw new Exception("Введите пароль");
|
||||||
}
|
}
|
||||||
APIClient.Access = password.Equals(APIClient.Password);
|
APIClient.GetAccess(password);
|
||||||
if (APIClient.Access == false)
|
|
||||||
|
if (APIClient.Access == false)
|
||||||
{
|
{
|
||||||
throw new Exception("Неправильный пароль");
|
throw new Exception("Неправильный пароль");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user