Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/zxcvbn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ def test_empty_password():
zxcvbn(password, user_inputs=[input_])
except IndexError as ie:
assert False, "Empty password raised IndexError"


def test_user_inputs_side_effects():
password = '7r3iz3|)0uz3'
input_ = [password]

guess1 = zxcvbn(password)['guesses_log10']
zxcvbn('somepassword', user_inputs=input_)
guess2 = zxcvbn(password)['guesses_log10']
assert abs(guess1 - guess2) < 1
2 changes: 2 additions & 0 deletions zxcvbn/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def wrapper(*args, **kwargs):
def omnimatch(password, _ranked_dictionaries=None, user_inputs=[]):
if len(user_inputs):
_ranked_dictionaries['user_inputs'] = build_ranked_dict(user_inputs)
elif 'user_inputs' in _ranked_dictionaries:
del(_ranked_dictionaries['user_inputs'])

matches = []
for matcher in [
Expand Down