Settings
django-password-policies-iplweb uses settings to customize the behaviour
of this application. While it provides useful defaults all of the following
attributes can be set individually for each project by adding the attribute
and its new value to the project’s settings file:
- password_policies.conf.settings.PASSWORD_CHANGE_MIDDLEWARE_ALLOW_LOGOUT = True
Determines wether the
PasswordChangeMiddlewareshould ignore the logout views, allowing the user to log out even if a password change is required.
- password_policies.conf.settings.PASSWORD_CHANGE_MIDDLEWARE_EXCLUDED_PATHS = []
A list of raw strings representing paths to ignore while checking if a user has to change his/her password.
- password_policies.conf.settings.PASSWORD_CHANGE_MIDDLEWARE_EXCLUDED_USERNAMES = []
A list of usernames to exclude from password expiry checks in the
PasswordChangeMiddleware. Users in this list will never be forced to change their password due to expiration.Useful for service accounts or bot users that should not be subject to password rotation policies.
- password_policies.conf.settings.PASSWORD_CHANGE_REQUIRED_ADMIN_SEARCH_FIELDS = ['id', 'user__id', 'user__first_name', 'user__email', 'user__last_name', 'user__username']
Determines which fields should be searched upon in the admin change list of the
PasswordChangeRequired
- password_policies.conf.settings.PASSWORD_CHECK_ONLY_AT_LOGIN = False
Don’t log the person out in the middle of a session. Only do the checks at login time.
- password_policies.conf.settings.PASSWORD_CHECK_SECONDS = 3600
Determines after how many seconds a check shall be performed if the user’s password has expired.
Defaults to 1 hour.
- password_policies.conf.settings.PASSWORD_COMMON_SEQUENCES = ['0123456789', '`1234567890-=', '~!@#$%^&*()_+', 'abcdefghijklmnopqrstuvwxyz', "quertyuiop[]\\asdfghjkl;'zxcvbnm,./", 'quertyuiop{}|asdfghjkl;"zxcvbnm<>?', 'quertyuiopasdfghjklzxcvbnm', "1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik,9ol.0p;/-['=]\\", 'qazwsxedcrfvtgbyhnujmikolp']
Specifies a list of common sequences to attempt to match a password against.
- password_policies.conf.settings.PASSWORD_COMPLEXITY_EXCLUDED_USERNAMES = []
A list of usernames to exclude from password complexity validation in
PasswordPoliciesFormand its subclasses. Users in this list will not have their passwords checked against complexity rules (character composition, entropy, dictionary words, etc.) or password history.Useful for service accounts or bot users that manage their own passwords programmatically.
- password_policies.conf.settings.PASSWORD_DICTIONARY = None
Specifies the location of a dictionary (file with one word per line). Could be “/usr/share/dict/words”.
Used by the
DictionaryValidator.
- password_policies.conf.settings.PASSWORD_DIFFERENCE_DISTANCE = 3
A minimum distance of the difference between old and new password. A positive integer. Values greater than 1 are recommended.
A value of 0 disables password similarity verification.
- password_policies.conf.settings.PASSWORD_DURATION_SECONDS = 5184000
Determines after how many seconds a user is forced to change his/her password.
Defaults to 60 days.
- password_policies.conf.settings.PASSWORD_HISTORY_ADMIN_SEARCH_FIELDS = ['id', 'user__id', 'user__first_name', 'user__email', 'user__last_name', 'user__username']
Determines which fields should be searched upon in the admin change list of the
PasswordHistory
- password_policies.conf.settings.PASSWORD_HISTORY_COUNT = 10
Specifies the number of user’s previous passwords to remember when the password history is being used.
Defaults to 10 entries.
- password_policies.conf.settings.PASSWORD_MATCH_THRESHOLD = 0.9
Specifies how close a fuzzy match has to be, considered a match.
Used by the
CommonSequenceValidator.
- password_policies.conf.settings.PASSWORD_MAX_CONSECUTIVE = 3
Specifies the maximum amount of consecutive characters allowed in passwords.
Used by the
ConsecutiveCountValidator.
- password_policies.conf.settings.PASSWORD_MAX_LENGTH = None
Specifies the maximum length for passwords.
Used by the
PasswordPoliciesField.
- password_policies.conf.settings.PASSWORD_MIN_ENTROPY_LONG = 5.3
Specifies the minimum entropy of long passwords (len(password) >= 100).
Used by the
EntropyValidator.
- password_policies.conf.settings.PASSWORD_MIN_ENTROPY_SHORT = 0.8
Specifies the minimum entropy of short passwords (len(password) < 100).
Used by the
EntropyValidator.
- password_policies.conf.settings.PASSWORD_MIN_LENGTH = 8
Specifies the minimum length for passwords.
Used by the
PasswordPoliciesField.
- password_policies.conf.settings.PASSWORD_MIN_LETTERS = 3
Specifies the minimum amount of required letters in a password.
Used by
LetterCountValidator.
- password_policies.conf.settings.PASSWORD_MIN_LOWERCASE_LETTERS = 0
Specifies the minimum amount of required lowercase letters in a password.
Used by
LowercaseLetterCountValidator.
- password_policies.conf.settings.PASSWORD_MIN_NUMBERS = 1
Specifies the minimum amount of required numbers in a password.
Used by the
NumberCountValidator.
- password_policies.conf.settings.PASSWORD_MIN_SYMBOLS = 1
Specifies the minimum amount of required symbols in a password.
Used by
SymbolCountValidator.
- password_policies.conf.settings.PASSWORD_MIN_UPPERCASE_LETTERS = 0
Specifies the minimum amount of required uppercase letters in a password.
Used by
UppercaseLetterCountValidator.
- password_policies.conf.settings.PASSWORD_MODEL_FIELD = 'password'
The field on the user model as defined by settings.AUTH_USER_MODEL where the password is stored.
- password_policies.conf.settings.PASSWORD_USE_CRACKLIB = False
Determines wether to validate passwords using the
CracklibValidator.
- password_policies.conf.settings.PASSWORD_USE_HISTORY = True
Determines wether to use the password history.
- password_policies.conf.settings.PASSWORD_WORDS = []
A list of project specific words to check a password against.
Used by the
DictionaryValidator.
- password_policies.conf.settings.REDIRECT_FIELD_NAME = 'next'
If a password expired and the user wants to visit any page a redirect is issued. By default, the URL the user wanted to visit before is remembered and stored as query string parameter called “next”. If you would prefer to use a different name for this parameter, the
PasswordChangeFormViewtakes an optionalredirect_field_namekeyword argument:url(r'^/password_change/$', PasswordChangeFormView.as_view(redirect_field_name='previous'), name="password_change"),
Note that if you provide a value to redirect_field_name, you will most likely need to customize your
PasswordChangeFormViewtemplate as well, since the template context variable which stores the redirect path will use the value of redirect_field_name as its key rather than “next” (the default).
- password_policies.conf.settings.TEMPLATE_403_PAGE = '403.html'
A path to a template to generate a 403 error page in the root of the template directory.