A translatable password validator for django, based on zxcvbn-python.
Project description
django-zxcvbn-password-validator
A translatable password validator for django, based on zxcvbn-python and available with pip.
Unlike rule-based validators (minimum length, must contain a digit...), zxcvbn estimates actual password strength using pattern matching, common password dictionaries, and keyboard layout analysis. It provides meaningful, actionable feedback to help users create stronger passwords.
Professional support for django-zxcvbn-password-validator is available as part of the Tidelift Subscription
How to use
Install the package:
pip install django-zxcvbn-password-validator
Add 'django_zxcvbn_password_validator' in the INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django_zxcvbn_password_validator"
]
Modify AUTH_PASSWORD_VALIDATORS:
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django_zxcvbn_password_validator.ZxcvbnPasswordValidator",
},
# ...
]
You could choose to use zxcvbn alone, but using it alongside Django's
UserAttributeSimilarityValidator is recommended.
Finally, you can set the PASSWORD_MINIMAL_STRENGTH to your liking (default is 2),
every password scoring lower than this number will be rejected:
# 0 too guessable: risky password. (guesses < 10^3)
# 1 very guessable: protection from throttled online attacks.
# (guesses < 10^6)
# 2 somewhat guessable: protection from unthrottled online attacks.
# (guesses < 10^8)
# 3 safely unguessable: moderate protection from offline slow-hash scenario.
# (guesses < 10^10)
# 4 very unguessable: strong protection from offline slow-hash scenario.
# (guesses >= 10^10)
PASSWORD_MINIMAL_STRENGTH = 0 if DEBUG else 4
If the password is not strong enough, we provide errors explaining what you need to do:
The error messages are translated to your target language (even the strings given by zxcvbn that are in English only):
Compatibility
Requires Django 2+ and Python 3.6+. Note that Python 3.6 and 3.7 are not tested in CI anymore (GitHub Actions no longer provides runners for them), so while they should work, there is no guarantee.
Translating the project
This project is available in 131 languages. Your contribution would be very appreciated if you know a language that is not yet available or if you want to improve an existing translation (especially AI-generated ones). See how to contribute
Translators
- Andrés Martano: Brazilian Portuguese
- Lionel Sausin: French
- Michal Čihař: Czech
- Pierre Sassoulas: French
- RViktor: Hungarian
- Thom Wiggers: Dutch
- Claude AI: Afrikaans, Akan, Albanian, Amharic, Arabic, Armenian, Assamese, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Brazilian Portuguese (corrections), Breton, Bulgarian, Burmese, Cantonese, Catalan, Cebuano, Chichewa, Chinese Simplified, Chinese Traditional, Corsican, Croatian, Danish, Esperanto, Estonian, Ewe, Faroese, Filipino, Finnish, Fulah, Galician, Georgian, German, Greek, Gujarati, Hausa, Hawaiian, Hebrew, Hindi, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Kinyarwanda, Kirundi, Korean, Kurdish, Kyrgyz, Lao, Latin, Latvian, Lingala, Lithuanian, Luganda, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Nepali, Northern Ndebele, Northern Sami, Norwegian Bokmål, Occitan, Odia, Oromo, Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Sango, Sardinian, Scottish Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Southern Ndebele, Spanish, Sundanese, Swahili, Swati, Swedish, Tajik, Tamil, Telugu, Thai, Tibetan, Tigrinya, Tongan, Tsonga, Tswana, Turkish, Turkmen, Twi, Ukrainian, Urdu, Uzbek, Venda, Vietnamese, Welsh, Western Frisian, Wolof, Xhosa, Yiddish, Yoruba, Zulu
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_zxcvbn_password_validator-1.6.0.tar.gz.
File metadata
- Download URL: django_zxcvbn_password_validator-1.6.0.tar.gz
- Upload date:
- Size: 304.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5afd5d92313dd0e274817706a16211f0660ff771ec4fb3e6d79b2512d1308ff1
|
|
| MD5 |
447f50474712d074bee86feb611534be
|
|
| BLAKE2b-256 |
82cdc3b59802974beac681db2d93d72afe872fb8a7e892f557a60ec5a144c487
|
File details
Details for the file django_zxcvbn_password_validator-1.6.0-py3-none-any.whl.
File metadata
- Download URL: django_zxcvbn_password_validator-1.6.0-py3-none-any.whl
- Upload date:
- Size: 432.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41d10997fb6325ed8f1d4694c8ebdeef760fb34994553df6f5603718035bb1b9
|
|
| MD5 |
37c85b6a2d223a1727a8e467b00a762e
|
|
| BLAKE2b-256 |
110b78be05d394e63d64925edaf37c149c4a47b39f4b22ac314c454235595fca
|