From 4216535016dbcc23d6033ad041a91f45099c0f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrabec?= Date: Mon, 11 Aug 2025 19:33:55 +0200 Subject: [PATCH] Prevent deleted user authentication --- DrinkRateAPI/Services/ApplicationUserService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DrinkRateAPI/Services/ApplicationUserService.cs b/DrinkRateAPI/Services/ApplicationUserService.cs index a2f735d..c30c395 100644 --- a/DrinkRateAPI/Services/ApplicationUserService.cs +++ b/DrinkRateAPI/Services/ApplicationUserService.cs @@ -13,7 +13,7 @@ public class ApplicationUserService(ApplicationDbContext context) { var appUserId = identity.FindFirst(ClaimTypes.NameIdentifier)?.Value; var profile = await _context.UserProfiles - .FirstAsync(x => x.ApplicationUserId.ToString() == appUserId) + .FirstAsync(x => x.ApplicationUserId.ToString() == appUserId && !x.IsDeleted) ?? throw new NotFoundException(); return profile;