diff --git a/omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java b/omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java index 64bd1c5a..186eca10 100644 --- a/omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java +++ b/omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java @@ -72,7 +72,7 @@ public class LoginServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession httpSession = request.getSession(); - Integer loginAttemptsByUser; + Integer loginAttemptsByUserName; String ipAddress = request.getRemoteAddr(); Integer loginAttempts = loginAttemptsByIP.get(ipAddress); if (loginAttempts == null) { @@ -80,7 +80,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } loginAttempts++; - loginAttemptsByUser = loginAttempts - 1; + loginAttemptsByUserName = loginAttempts - 1; boolean lockedOut = false; // look up the allowed # of attempts per IP Integer allowedLockoutAttempts = 100; @@ -186,12 +186,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) String maximumAttempts = Context.getAdministrationService().getGlobalProperty(GP_MAXIMUM_ALLOWED_LOGINS, "7"); Integer maximumAlowedAttempts = Integer.valueOf(maximumAttempts); - if (loginAttemptsByUser <= maximumAlowedAttempts) { + if (loginAttemptsByUserName <= maximumAlowedAttempts) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "auth.password.invalid"); } - if (loginAttemptsByUser > maximumAlowedAttempts) { + if (loginAttemptsByUserName > maximumAlowedAttempts) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "legacyui.lockedOutMessage"); } } diff --git a/omod/src/test/java/org/openmrs/web/servlet/LoginServletTest.java b/omod/src/test/java/org/openmrs/web/servlet/LoginServletTest.java index 02c98846..d9264825 100644 --- a/omod/src/test/java/org/openmrs/web/servlet/LoginServletTest.java +++ b/omod/src/test/java/org/openmrs/web/servlet/LoginServletTest.java @@ -97,7 +97,7 @@ public void shouldLockUserOutAfterFiveFailedLoginAttempts() throws Exception { loginServlet.service(request, response); } - // now attempting to log in the fifthth time should fail + // now attempting to log in the fifth time should fail MockHttpServletRequest request = new MockHttpServletRequest("POST", "/loginServlet"); request.setContextPath("/somecontextpath"); MockHttpServletResponse response = new MockHttpServletResponse();