этот коммит этот коммит 5

This commit is contained in:
AnnZhimol 2023-04-25 09:35:46 +04:00
parent 7c900c51b5
commit 812d5869d5
2 changed files with 10 additions and 3 deletions

View File

@ -2,14 +2,16 @@
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
using SoftwareInstallationClientApp.Controllers;
namespace SoftwareInstallationStoreApp
{
public class APIClient
{
private static readonly HttpClient _client = new();
public static string Password { get; private set; } = string.Empty;
public static bool Access { get; set; } = false;
private static string Password = string.Empty;
public static bool Access { get; private set; }
public static void Connect(IConfiguration configuration)
{
@ -33,6 +35,11 @@ namespace SoftwareInstallationStoreApp
}
}
public static void GetAccess(string password)
{
Access = Password.Equals(password);
}
public static void PostRequest<T>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);

View File

@ -28,7 +28,7 @@ namespace SoftwareInstallationClientApp.Controllers
{
throw new Exception("Введите пароль");
}
APIClient.Access = password.Equals(APIClient.Password);
APIClient.GetAccess(password);
if (APIClient.Access == false)
{
throw new Exception("Неправильный пароль");