-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lui 83 #99
base: master
Are you sure you want to change the base?
Lui 83 #99
Conversation
Can you include the ticket id in your commit message? |
ok let me do that |
@@ -178,7 +180,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) | |||
catch (ContextAuthenticationException e) { | |||
// set the error message for the user telling them | |||
// to try again | |||
httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "auth.password.invalid"); | |||
Integer maximumAlowedAttempts = 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you make the maximum allowed attempts 7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because thats the default maximum allowed attemptts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have realised its a configurable figure , so let just try to acces it using a global property
f4f774a
to
b2edebf
Compare
i have replaced the hard coded figure "7" with the Global property |
@@ -97,7 +97,7 @@ public void shouldLockUserOutAfterFiveFailedLoginAttempts() throws Exception { | |||
loginServlet.service(request, response); | |||
} | |||
|
|||
// now attempting to log in the fifth time should fail | |||
// now attempting to log in the fifthth time should fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to make the above change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no that was accidenta, coz at some point , the tests were failing so i was cross checkingthem , but that was un intended. thx
String ipAddress = request.getRemoteAddr(); | ||
Integer loginAttempts = loginAttemptsByIP.get(ipAddress); | ||
if (loginAttempts == null) { | ||
loginAttempts = 1; | ||
} | ||
|
||
loginAttempts++; | ||
|
||
loginAttemptsByUser = loginAttempts - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference btn loginAttemptsByUser and loginAttempts? Are there attempts that aren't made by a User?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i intended to differentiate between loginAttempts by User name , and loginAttempts by IP address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you improve the naming to reflect that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alryt sam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i updated it
Displaying meaningful infowen user is locked made the variable local displaying use ful info when user is locked out LUI-83 : modified the method to use global property LUI-83 : modified the method to use global property LUI-83: Correcting the Variable Naming
hi @dkayiwa and @samuelmale . i corrected the Naming |
|
||
} | ||
|
||
if (loginAttemptsByUserName > maximumAlowedAttempts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think use of if else here will be much better because we are to check for only one of the condition and not both separately.
@dkayiwa is this ready for merging? Can we wrap up this old work? |
https://issues.openmrs.org/browse/LUI-83