Additional libraries for validating passwords in Django.
Project description
Additional libraries for validating passwords in Django 2.2.8 or later.
django-password-validators requires Django 2.2.8 or greater.
The application works well under python 3.x and 2.x versions.
Django version after the number 1.9, allows you to configure password validation. Configuration validation is placed under the variable AUTH_PASSWORD_VALIDATORS.
Installation
Just install django-password-validators via pip:
$ pip install django-password-validators
Validators
UniquePasswordsValidator
Validator checks if the password was once used by a particular user. If the password is used, then an exception is thrown, of course.
For each user, all the passwords are stored in a database. All passwords are strongly encrypted.
Configuration…
In the file settings.py we add
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'
And run
python manage.py migrate
PasswordCharacterValidator
The validator checks for the minimum number of characters of a given type.
In the file settings.py we add
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': "~!@#$%^&*()_+{}\":;'[]" } }, ... ]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-password-validators-1.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 080bd85be836d6d574afb7871aee4c2975453565c88002569cd4b3d3dd63d274 |
|
MD5 | 0184950ecbcfedf068b8caddfe8169eb |
|
BLAKE2b-256 | bcc4386b5484a779e2fb4fc8ba4212261f88d4e49506254f9f996c903405d7ce |
Hashes for django_password_validators-1.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c9800fa5acf5072f88a2fd520e68fab296274a52cb985dfc54f6d96f235a2fd |
|
MD5 | 34ad7742e15bacbb2519435e76e7ab1f |
|
BLAKE2b-256 | 58b2988367256839f213605d40de5a0db0ae2043469af60c3b308ed9b8e16b83 |