Password generation and verification utility for Zope3
This package provides an API and implementation of a password generation and verification utility. A high-security implementation is provided that is suitable for banks and other high-security institutions. The package also offers a field and a property for those fields.
- 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%)
Better error messages for invalid password exceptions (when you reject the user’s password for being too short or too long, it’s only polite to tell them what the minimum/maximum password length is).
This introduces new translatable strings which haven’t been translated yet.
- Minor changes:
- Password field: added ignoreEmpty=False parameter
- previousPasswords: always set the property, not just append
- some caching of IPasswordOptionsUtility property usage
- Check for relevancy of the request when counting failed login attempts as early as possible. This prevents account locked errors raised for things like resources.
- Added Dutch translations (janwijbrand)
- Feature: failedAttemptCheck:
- increment failedAttempts on all/any request (this is the default)
- increment failedAttempts only on non-resource requests
- increment failedAttempts only on POST requests
- Feature: more specific exceptions on new password verification.
- Fix: PrincipalMixIn.passwordSetOn happens to be None in case the class is mixed in after the user was created, that caused a bug.
- Fix: disallowPasswordReuse must not check None passwords.
- German translations
- Feature: passwordOptionsUtilityName property on the PrincipalMixIn. This allows to set different options for a set of users instead of storing the direct values on the principal.
- Feature: Even harder password settings:
- minUniqueLetters: count and do not allow less then specified number
- disallowPasswordReuse: do not allow to set a previously used password
- 100% test coverage
PrincipalMixIn got some new properties:
- passwordExpired: to force the expiry of the password
- lockOutPeriod: to enable automatic lock and unlock on too many bad tries
IPasswordOptionsUtility to have global password options:
- changePasswordOnNextLogin: not implemented here, use PrincipalMixIn.passwordExpired
- lockOutPeriod: global counterpart of the PrincipalMixIn property
- passwordExpiresAfter: global counterpart of the PrincipalMixIn property
- maxFailedAttempts: global counterpart of the PrincipalMixIn property
Password checking goes like this (on the high level):
- raise AccountLocked if too many bad tries and account should be locked
- raise PasswordExpired if expired AND password matches
- raise TooManyLoginFailures if too many bad tries
- return whether password matches
More details in principal.txt
Added Russian translation
Refactor PrincipalMixIn now() into a separate method to facilitate override and testing
Changed the order the password is checked:
- check password against stored
- check maxFailedAttempts, raise TooManyLoginFailures if over
- if password is OK, check expirationDate, raise PasswordExpired if over
- return whether password matches
This is because I need to be sure that PasswordExpired is raised only if the password IS valid. Entering an invalid password MUST NOT raise PasswordExpired, because I want to use PasswordExpired to allow the user to change it’s password. This should not happen if the user did not enter a valid password.
- Initial Release