Skip to content

Commit f596bef

Browse files
robotmlgdwolfhub
authored andcommitted
Match the correct dictionary name for English words
1 parent e766e30 commit f596bef

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/zxcvbn_test.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,16 @@ def test_long_password():
2323
input_ = None
2424
password = "weopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioejiojweopiopdsjmkldjvoisdjfioej"
2525

26-
zxcvbn(password, user_inputs=[input_])
26+
zxcvbn(password, user_inputs=[input_])
27+
28+
29+
def test_dictionary_password():
30+
# return the correct error message for a english match
31+
input_ = None
32+
password = "musculature"
33+
34+
result = zxcvbn(password, user_inputs=[input_])
35+
36+
assert result["feedback"]["warning"] == \
37+
"A word by itself is easy to guess.", \
38+
"Gives specific error for single-word passwords"

zxcvbn/feedback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def get_dictionary_match_feedback(match, is_sole_match):
103103
warning = _('This is a very common password.')
104104
elif match['guesses_log10'] <= 4:
105105
warning = _('This is similar to a commonly used password.')
106-
elif match['dictionary_name'] == 'english':
106+
elif match['dictionary_name'] == 'english_wikipedia':
107107
if is_sole_match:
108108
warning = _('A word by itself is easy to guess.')
109109
elif match['dictionary_name'] in ['surnames', 'male_names',

0 commit comments

Comments
 (0)