Különböző logok, különböző file-ba

This commit is contained in:
2025-04-14 20:15:00 +02:00
parent ca71bd2194
commit 380b6ac030
4 changed files with 85 additions and 9 deletions
+13 -2
View File
@@ -128,6 +128,8 @@ namespace WorkFlowCheck.BL.Services
var retVal = "";
try
{
Log.ForContext("TAG", "AuditFlow").Information($"Bejelentkezési kísérlet: {userName}");
var user = await _dbContext.Users
.Include(i => i.UserRoles)
.ThenInclude(i => i.Role)
@@ -154,11 +156,15 @@ namespace WorkFlowCheck.BL.Services
user.Email,
}, "Bejelentkezés megerősítése",
Get2FConfirmationMessageBody(code));
Log.ForContext("TAG", "AuditFlow").Information($"Bejelentkezési kísérlet, email küldés: {user.Email}");
retVal = CodeGenerator2F.GenerateToken2F(userName, password, code);
return retVal;
}
}
else
{
Log.ForContext("TAG", "AuditFlow").Error($"Sikertelen bejelentkezési kísérlet: {userName}");
}
}
catch (Exception ex)
{
@@ -198,9 +204,14 @@ namespace WorkFlowCheck.BL.Services
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<UserDTO>(user);
Log.ForContext("TAG", "AuditFlow").Information($"Sikeres azonosítás!: {userName}");
return retVal;
}
}
else
{
Log.ForContext("TAG", "AuditFlow").Error($"Sikertelen bejelentkezési kísérlet: {userName}");
}
}
catch (Exception ex)
{
@@ -241,7 +252,7 @@ namespace WorkFlowCheck.BL.Services
RoleName = item.Role.RoleName,
});
}
user.PasswordHash = PasswordHasher.HashPassword(newPassword);
user.JwtToken = GenerateJwtToken(userDTO);
await _dbContext.SaveChangesAsync();