Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Lui 83 #99

wants to merge 1 commit into from

Conversation

mozzy11
Copy link
Member

@mozzy11 mozzy11 commented Jan 3, 2019

@dkayiwa
Copy link
Member

dkayiwa commented Jan 11, 2019

Can you include the ticket id in your commit message?

@mozzy11
Copy link
Member Author

mozzy11 commented Jan 14, 2019

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;
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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

@mozzy11 mozzy11 force-pushed the LUI-83 branch 2 times, most recently from f4f774a to b2edebf Compare February 1, 2019 12:08
@mozzy11
Copy link
Member Author

mozzy11 commented Feb 1, 2019

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
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

@mozzy11 mozzy11 Feb 8, 2019

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

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alryt sam

Copy link
Member Author

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
@mozzy11
Copy link
Member Author

mozzy11 commented Feb 11, 2019

hi @dkayiwa and @samuelmale . i corrected the Naming

5a85203


}

if (loginAttemptsByUserName > maximumAlowedAttempts) {
Copy link
Member

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.

@gracepotma
Copy link

@dkayiwa is this ready for merging? Can we wrap up this old work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants