From a435a59e298de4495c50a55f528171144bd68f23 Mon Sep 17 00:00:00 2001 From: "HOME-LAPTOP\\kshkulev" Date: Fri, 17 Oct 2025 11:31:39 +0900 Subject: [PATCH] Localize error --- Hcs.WebApp/Controllers/IdentityController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Hcs.WebApp/Controllers/IdentityController.cs b/Hcs.WebApp/Controllers/IdentityController.cs index 0ee2f39..e1bf463 100644 --- a/Hcs.WebApp/Controllers/IdentityController.cs +++ b/Hcs.WebApp/Controllers/IdentityController.cs @@ -91,6 +91,13 @@ namespace Hcs.WebApp.Controllers { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var user = await userManager.FindByIdAsync(userId); + + var isPasswordCorrect = await userManager.CheckPasswordAsync(user, oldPassword); + if (!isPasswordCorrect) + { + return BadRequest("Неверный текущий пароль"); + } + var result = await userManager.ChangePasswordAsync(user, oldPassword, newPassword); if (result.Succeeded) {