Skip to content

Commit

Permalink
TRUNK-6135: Reapply change to properly handle blank lockoutTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored and Wandji69 committed Jun 9, 2024
1 parent e43907c commit ee47dc6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ public User authenticate(String login, String password) throws ContextAuthentica
log.debug("Candidate user id: {}", candidateUser.getUserId());

String lockoutTimeString = candidateUser.getUserProperty(OpenmrsConstants.USER_PROPERTY_LOCKOUT_TIMESTAMP, null);
Long lockoutTime = null;
if (lockoutTimeString != null && !"0".equals(lockoutTimeString)) {
long lockoutTime = -1;
if (StringUtils.isNotBlank(lockoutTimeString) && !"0".equals(lockoutTimeString)) {
try {
// putting this in a try/catch in case the admin decided to put junk into the property
lockoutTime = Long.valueOf(lockoutTimeString);
lockoutTime = Long.parseLong(lockoutTimeString);
}
catch (NumberFormatException e) {
log.warn("bad value stored in {} user property: {}", OpenmrsConstants.USER_PROPERTY_LOCKOUT_TIMESTAMP,
Expand Down

0 comments on commit ee47dc6

Please sign in to comment.