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

Login limit on wrong password. #1043

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

nupur-khare
Copy link
Contributor

  1. Fixed VAPT security issue - Login limit to 3 if the password is wrong.
  2. Fixed test cases.

response = client.post(
"/api/auth/login",
data={"username": "[email protected]", "password": "Welcome@10"},
data={"username": "[email protected]", "password": "Welcome@3010"},
).json()
print(response)
assert not response['success']
Copy link
Contributor

Choose a reason for hiding this comment

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

change message to "Account frozen due to too many unsuccessful login attempts. Please come back in ..... "

with pytest.raises(AppException, match='Only 3 logins are allowed within 120 minutes. '
f'Please come back in *'):
Authentication.generate_login_tokens(user, True)
Copy link
Contributor

Choose a reason for hiding this comment

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

??

@@ -157,9 +157,10 @@ def create_access_token(*, data: dict, token_type: TOKEN_TYPE = TOKEN_TYPE.LOGIN
def __authenticate_user(username: str, password: str):
user = AccountProcessor.get_user_details(username, is_login_request=True)
if not user or not Utility.verify_password(password, user["password"]):
UserActivityLogger.is_login_within_cooldown_period(username)
Copy link
Contributor

Choose a reason for hiding this comment

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

put this check before retrieving user details

Copy link
Contributor

@udit-pandey udit-pandey left a comment

Choose a reason for hiding this comment

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

approved

@udit-pandey udit-pandey merged commit b8108d8 into digiteinfotech:master Oct 5, 2023
5 checks passed
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.

2 participants