Added logging mechanism for user actions.

This commit is contained in:
piyushkag
2024-11-20 12:03:09 +05:30
parent bab6fcfad6
commit 6eafa7b33e
26 changed files with 798 additions and 42 deletions

View File

@@ -94,13 +94,14 @@ public class UserDao {
log.info("User created with ID: {}", userEntity.getId());
LoginReq loginReq=new LoginReq();
loginReq.setEmail(userEntity.getEmail());
LoginAttemptEntity loginAttemptEntity = null;
if(userEntity!=null){
LoginAttemptEntity loginAttemptEntity =authenticationService.prepareLoginAttemptEntity(loginReq, request);
loginAttemptEntity = authenticationService.prepareLoginAttemptEntity(loginReq, request);
log.info("Authentication failed for email: {}", loginReq.getEmail());
loginAttemptEntity.setUserId(userEntity.getId());
authenticationService.createSuccessLoginAttempt(loginAttemptEntity);
}
return authService.getJWTTokenBean(userEntity, Boolean.TRUE);
return authService.getJWTTokenBean(userEntity, Boolean.TRUE, loginAttemptEntity.getId());
}
private BeneficiaryEntity createBeneficiary(RoleEntity roleEntity, UserReq userReq, HubEntity hub) {