Сданная LabWork05_Hard.
This commit is contained in:
parent
cba839f32a
commit
0ff4abc04a
@ -10,7 +10,7 @@ namespace BlacksmithWorkshopShopApp
|
||||
|
||||
public static string Password { get; private set; } = string.Empty;
|
||||
|
||||
public static bool InSystem { get; set; }
|
||||
public static bool InSystem { get; private set; }
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
@ -20,7 +20,13 @@ namespace BlacksmithWorkshopShopApp
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
public static bool CheckPassword(string password)
|
||||
{
|
||||
APIClient.InSystem = password == Password;
|
||||
return APIClient.InSystem;
|
||||
}
|
||||
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
|
@ -54,10 +54,8 @@ namespace BlacksmithWorkshopShopApp.Controllers
|
||||
throw new Exception("Введите пароль");
|
||||
}
|
||||
|
||||
APIClient.InSystem = APIClient.Password == password;
|
||||
|
||||
if (!APIClient.InSystem)
|
||||
{
|
||||
if (APIClient.CheckPassword(password))
|
||||
{
|
||||
throw new Exception("Неверный пароль");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user