Skip to content

Commit

Permalink
- TooSimilarPassword: do not round maxSimilarity up, because we
Browse files Browse the repository at this point in the history
  sometimes use 0.999 to avoid the same password set.
  0.999 would be displayed as 100% (100% vs. 100%)
  • Loading branch information
Adam Groszer committed Sep 19, 2012
1 parent c5d3068 commit 39c2f59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ CHANGES
0.11.1 (unreleased)
-------------------

- Nothing changed yet.
- ``TooSimilarPassword``: do not round ``maxSimilarity`` up, because we
sometimes use 0.999 to avoid the same password set.
0.999 would be displayed as 100% (100% vs. 100%)


0.11.0 (2012-08-09)
Expand Down
8 changes: 8 additions & 0 deletions src/z3c/password/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ letters, digits, punctuation, other), and the maximum similarity score.
...
TooSimilarPassword: Password is too similar to old one (similarity 88%, should be at most 60%).

>>> pwd2 = password.HighSecurityPasswordUtility()
>>> pwd2.maxSimilarity = 0.999

>>> pwd2.verify('fooBar12', 'fooBar12')
Traceback (most recent call last):
...
TooSimilarPassword: Password is too similar to old one (similarity 100%, should be at most 99%).

- The final check ensures that the password does not have too many characters
of one group. The groups are: lower letters, upper letters, digits,
punctuation, and others.
Expand Down
2 changes: 1 addition & 1 deletion src/z3c/password/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, similarity=None, maxSimilarity=None):
'Password is too similar to old one'
' (similarity ${similarity}%, should be at most ${maxSimilarity}%).',
mapping=dict(similarity=int(round(similarity * 100)),
maxSimilarity=int(round(maxSimilarity * 100))))
maxSimilarity=int(maxSimilarity * 100)))

class TooManyGroupCharacters(InvalidPassword):
__doc__ = _('''Password contains too many characters of one group.''')
Expand Down

0 comments on commit 39c2f59

Please sign in to comment.