From ffe3f57242b7f665b9d8029ff7ad3267d217e231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9?= Date: Mon, 15 May 2023 19:12:19 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HardwareShopRestApi/Controllers/UserController.cs | 4 ++-- .../HardwareShopWorkerApp/Controllers/HomeController.cs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/HardwareShop/HardwareShopRestApi/Controllers/UserController.cs b/HardwareShop/HardwareShopRestApi/Controllers/UserController.cs index 0944eed..d430e4c 100644 --- a/HardwareShop/HardwareShopRestApi/Controllers/UserController.cs +++ b/HardwareShop/HardwareShopRestApi/Controllers/UserController.cs @@ -21,13 +21,13 @@ namespace HardwareShopRestApi.Controllers } [HttpGet] - public UserViewModel? Login(string login, string password) + public UserViewModel? Login(string email, string password) { try { return _logic.ReadElement(new UserSearchModel { - Email = login, + Email = email, Password = password }); } diff --git a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs index 6970d98..354ecc3 100644 --- a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs +++ b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs @@ -28,7 +28,7 @@ namespace HardwareShopWorkerApp.Controllers { throw new Exception("Введите логин, email, пароль"); } - APIClient.PostRequest("api/client/register", new UserBindingModel + APIClient.PostRequest("api/user/register", new UserBindingModel { Login = login, Email = email, @@ -67,6 +67,11 @@ namespace HardwareShopWorkerApp.Controllers { throw new Exception("Введите почту и пароль"); } + APIClient.User = APIClient.GetRequest($"api/user/login?email={email}&password={password}"); + if (APIClient.User == null) + { + throw new Exception("Неверные почта и/или пароль"); + } Response.Redirect("MainWorker"); }