Merge pull request #385 from Kitzanos/handled-non-existent-user-prod

Cherry-pick ( Handled non-existent user login error)
This commit is contained in:
Rinaldo
2026-03-05 11:34:34 +01:00
committed by GitHub
4 changed files with 6 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ public class GepafinConstant {
public static final String USER_UPDATED_SUCCESS_MSG = "user.updated.success";
public static final String USER_DELETED_SUCCESS_MSG = "user.deleted.success";
public static final String USER_NOT_FOUND_MSG = "user.not.found";
public static final String INVALID_USERNAME_AND_PASSWORD = "invalid.username.or.password";
public static final String CREATE_USER_ERROR_MSG = "create_user_error_msg";
public static final String UPDATE_USER_ERROR_MSG = "update_user_error_msg";
public static final String DELETE_USER_ERROR_MSG = "delete_user_error_msg";

View File

@@ -96,7 +96,7 @@ public class AuthenticationService {
RoleStatusEnum.ROLE_BENEFICIARY.getValue()
).orElseThrow(() -> new ResourceNotFoundException(
Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.USER_NOT_FOUND_MSG)
Translator.toLocale(GepafinConstant.INVALID_USERNAME_AND_PASSWORD)
));
String emailWithHubId = loginReq.getEmail()+":"+loginReq.getHubUuid();
@@ -115,7 +115,7 @@ public class AuthenticationService {
createSuccessLoginAttempt(loginAttemptEntity);
} catch (Exception e) {
log.info("Authentication failed for email: {}", loginReq.getEmail());
loginAttemptEntity.setUserId(user.getId());
// loginAttemptEntity.setUserId(user.getId());
createFailedLoginAttempt(loginAttemptEntity, e.getMessage());
throw e;
}
@@ -238,7 +238,7 @@ public class AuthenticationService {
return getJWTTokenBean(userEntity, Boolean.TRUE, loginAttempt.getId(),null);
} catch (Exception e) {
log.info("Authentication login failed for email: {}",e.getMessage());
loginAttemptEntity.setUserId(userId);
// loginAttemptEntity.setUserId(userId);
createFailedLoginAttempt(loginAttemptEntity, e.getMessage());
throw e;
}

View File

@@ -2,6 +2,7 @@ user.created.success=User created successfully.
user.updated.success=User updated successfully.
user.deleted.success=User deleted successfully.
user.not.found=User not found.
invalid.username.or.password= Invalid username or password.
create_user_error_msg=An error occurred while creating the user.
update_user_error_msg=An error occurred while updating the user.
delete_user_error_msg=An error occurred while deleting the user.

View File

@@ -2,6 +2,7 @@ user.created.success=Utente creato con successo.
user.updated.success=Utente aggiornato con successo.
user.deleted.success=Utente eliminato con successo.
user.not.found=Utente non trovato.
invalid.username.or.password= Nome utente o password non validi.
create_user_error_msg=Si ? verificato un errore durante la creazione dell'utente.
update_user_error_msg=Si ? verificato un errore durante l'aggiornamento dell'utente.
delete_user_error_msg=Si ? verificato un errore durante l'eliminazione dell'utente.