Django ZXCVBN Password
Back-end and Front-end password validation with ZXCVBN.
A combination of pirandig’s django-zxcvbn and aj-may’s django-password-strength Django apps. It combines back-end and front-end validation with strength meter display.
License
Software licensed under ISC license.
Installation
pip install django-zxcvbn-password
Usage
# settings.py
AUTH_PASSWORD_VALIDATORS = [{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
}, {
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
}, {
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
}, {
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
}, {
'NAME': 'zxcvbn_password.ZXCVBNValidator',
'OPTIONS': {
'min_score': 3,
'user_attributes': ('username', 'email', 'first_name', 'last_name')
}
}]
# forms.py
from django import forms
from zxcvbn_password.fields import PasswordField, PasswordConfirmationField
class RegisterForm(forms.Form):
password1 = PasswordField()
password2 = PasswordConfirmationField(confirm_with=’password1’)
By default, other inputs won’t be used to compute the score, but you can enforce it like this:
# forms.py
from zxcvbn_password import zxcbnn
# in your form class
def clean():
password = self.cleaned_data.get('password')
other_field1 = ...
other_field2 = ...
if password:
score = zxcvbn(password, [other_field1, other_field2])['score']
# raise forms.ValidationError if needed
return self.cleaned_data
Screen-shot
Development
To run all the tests: tox
Changelog
2.0.0 (2017-02-17)
Drop Django 1.8 support in favor of AUTH_PASSWORD_VALIDATORS setting introduced in Django 1.9.
Update zxcvbn to more recent version (dwolfhub/zxcvbn-python on GitHub).
Update JavaScript code to latest version.
Remove all settings (they now go in AUTH_PASSWORD_VALIDATOR options).
Change license to ISC.
Thanks to Nick Stefan and Daniel Wolf.
1.1.0 (2016-10-18)
Cookiecutterize the project.
1.0.5 (2015-03-31)
I don’t remember.
1.0.3 (2015-03-12)
Switch README to rst.
Fix manifest rules.
1.0.2 (2015-03-12)
Change package name from django_zxcvbn_password to zxcvbn_password.
1.0.0 (2015-02-21)
Beta release on PyPI.
0.1.0 (2015-02-01)
Alpha release on PyPI.
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-2.0.0.tar.gz.
File metadata
- Download URL: django-zxcvbn-password-2.0.0.tar.gz
- Upload date:
- Size: 416.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3176c92387b59f4188787ee0ea7459c7b3fbda177ef1892549e73aa8d7c5df7
|
|
| MD5 |
0ae52e5c5bb008544def903b9be2edcb
|
|
| BLAKE2b-256 |
0563d904c983d72a09291cb83736b5655e14fc7b892629513535a902aafd00b3
|
File details
Details for the file django_zxcvbn_password-2.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_zxcvbn_password-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 408.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fde57e6b7f862e22024681b53423c0012d6f55d1260836ea9dc6679bd8dffe0f
|
|
| MD5 |
6378f77f3b42aafe192c6d29794ae78e
|
|
| BLAKE2b-256 |
f27954644a41c808ba466147e750b4285b03aaef63b99288323be66cd35471a5
|