Handled non-existent user login error

This commit is contained in:
rajesh
2026-03-05 15:42:03 +05:30
parent eb5e0f73e2
commit aa34bf698e
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;
}