42
loading...
This website collects cookies to deliver better user experience
pipenv install django-password-validators
pipenv lock -r >requirements.txt
INSTALLED_APPS = [
...
'django_password_validators',
...
]
AUTH_PASSWORD_VALIDATORS = [
...
{
'NAME': 'django_password_validators.password_character_requirements.password_validation.PasswordCharacterValidator',
'OPTIONS': {
'min_length_digit': 1,
'min_length_alpha': 2,
'min_length_special': 3,
'min_length_lower': 4,
'min_length_upper': 5,
'special_characters': "~!@#$%^&*()_+{}\":;'[]"
}
},
...
]
INSTALLED_APPS = [
...
'django_password_validators',
'django_password_validators.password_history',
...
]
AUTH_PASSWORD_VALIDATORS = [
...
{
'NAME': 'django_password_validators.password_history.password_validation.UniquePasswordsValidator',
'OPTIONS': {
# How many recently entered passwords matter.
# Passwords out of range are deleted.
# Default: 0 - All passwords entered by the user. All password hashes are stored.
'last_passwords': 5 # Only the last 5 passwords entered by the user
}
},
...
]
# If you want, you can change the default hasher for the password history.
DPV_DEFAULT_HISTORY_HASHER = 'django_password_validators.password_history.hashers.HistoryHasher'