Incorrect digit check in check_strength function only verifies if the first character is a number, missing digits elsewhere in the password. #14
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
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
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
Possible Fixes
Replace if
password[0].isdigit()
withif any(c.isdigit() for c in password)
to properly check for digits throughout the entire password.The text was updated successfully, but these errors were encountered: