Skip to content

Commit

Permalink
LUI-83: Correcting the Variable Naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Feb 11, 2019
1 parent b2edebf commit e23926e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ 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) {
loginAttempts = 1;
}

loginAttempts++;
loginAttemptsByUser = loginAttempts - 1;
loginAttemptsByUserName = loginAttempts - 1;
boolean lockedOut = false;
// look up the allowed # of attempts per IP
Integer allowedLockoutAttempts = 100;
Expand Down Expand Up @@ -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");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e23926e

Please sign in to comment.