Welcome to django-password-validation!

A backport of the password validation system from Django 1.9 (by Erik Romijn), for use on earlier Django versions.

Password validation isn’t hard to implement yourself, but if you use this backport you’ll be writing your validators to the same API that will be built-in to upcoming Django versions.

Prerequisites

django-password-validation supports Django 1.8.2 and later on Python 2.7, 3.3, 3.4, pypy, and pypy3.

Installation

django-password-validation is available on PyPI. Install it with:

pip install django-password-validation

Usage

Just follow the Django documentation!

When using the built-in validators in your AUTH_PASSWORD_VALIDATORS setting, use import paths like e.g. 'password_validation.MinimumLengthValidator' in place of 'django.contrib.auth.password_validation.MinimumLengthValidator'.

In place of the built-in views for password setting/changing you’ll need to switch to using password_validation.views.password_reset_confirm and password_validation.views.password_change.

If you have your own custom views for changing or resetting passwords, use password_validation.forms.SetPasswordForm or password_validation.forms.PasswordChangeForm instead of django.contrib.auth.forms.SetPasswordForm or django.contrib.auth.forms.PasswordChangeForm in those views.

A validation-enabled admin password change form is not currently provided here. Pull requests welcome!

Contributing

See the contributing docs.