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

Incorrect digit check in check_strength function only verifies if the first character is a number, missing digits elsewhere in the password. #14

Open
2 tasks
Advaitgaur004 opened this issue Oct 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working bugbounty Bug Bounty event hosted by Devlup Labs, inviting developers to identify and report bugs good first issue Good for newcomers

Comments

@Advaitgaur004
Copy link
Member

Description

The PasswordChecker class currently has a bug in the check_strength function, where it only checks if the first character of the password is a digit. This leads to incorrect strength scoring when passwords contain digits in any position other than the first.

Files

password_checker.py

To Reproduce

  1. Initialize the PasswordChecker class.
  2. Run the check_strength method with a password that contains numbers not at the start, e.g., "weakpass2".
  3. Observe that the feedback suggests the password lacks a number, despite containing one.

Expected Behavior

The check_strength function should correctly identify numbers anywhere in the password and adjust the strength score and feedback accordingly.

Actual Behavior

The function only checks if the first character is a digit. If the number is placed elsewhere in the password, the feedback incorrectly states that a number is missing.

Tasks

  • Modify the number-checking condition in the check_strength method to check for digits anywhere in the password.
  • Update any affected tests or add new ones if needed.

Possible Fixes

Replace if password[0].isdigit() with if any(c.isdigit() for c in password) to properly check for digits throughout the entire password.

@Advaitgaur004 Advaitgaur004 added bugbounty Bug Bounty event hosted by Devlup Labs, inviting developers to identify and report bugs bug Something isn't working good first issue Good for newcomers labels Oct 25, 2024
@gitdevjin
Copy link

I think I can handle this. I will open a PR

@Advaitgaur004
Copy link
Member Author

@gitdevjin go ahead, i'll assign this issue to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bugbounty Bug Bounty event hosted by Devlup Labs, inviting developers to identify and report bugs good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants