Prevent deleted user authentication

This commit is contained in:
Jiří Vrabec 2025-08-11 19:33:55 +02:00
parent 7bf7f23925
commit 4216535016

View file

@ -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;