-
Notifications
You must be signed in to change notification settings - Fork 79
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
Conversation
nupur-khare
commented
Oct 3, 2023
- Fixed VAPT security issue - Login limit to 3 if the password is wrong.
- Fixed test cases.
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'] |
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.
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) |
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.
??
kairon/shared/auth.py
Outdated
@@ -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) |
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.
put this check before retrieving user details
2. Fixed test cases.
2. Fixed test cases.
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.
approved