Skip to main content

django-password-policies-iplweb

Tests Docs PyPI Version Python Version License

A Django application that provides unicode-aware password policies on password changes and resets, along with a mechanism to force password changes.

Originally developed by Tarak Blah as django-password-policies. This fork is actively maintained by IPLweb.

Support graciously provided by

IPLweb

Why?

Django's built-in authentication provides basic password hashing and validation, but lacks enterprise-grade password policy enforcement — expiration, reuse prevention, forced rotation, and fine-grained complexity rules. This package fills that gap with a pluggable, configurable set of policies that integrate with Django's auth system.

Features

  • Password expiration — automatically expire passwords after a configurable duration (default: 60 days)
  • Forced password changes — redirect users to password change form via middleware, with admin bulk action support
  • Password history — prevent reuse of the last N passwords (default: 10)
  • 11 built-in validators — letter/number/symbol counts, consecutive character limits, common sequence detection, entropy checks, dictionary lookup, cracklib support, email rejection
  • Password similarity check — Levenshtein distance comparison between old and new passwords
  • Complete password change/reset views — six class-based views with customizable templates and URLs
  • Django admin integration — admin panels for password history and forced change management
  • 26 configurable settings — fine-tune every aspect of password policy enforcement
  • Context processor — exposes password_change_required flag to templates
  • Unicode-aware — full unicode support in password validation
  • I18N ready — all user-facing messages use Django's translation framework

Supported versions

Django \ Python 3.10 3.11 3.12 3.13
4.2 LTS
5.2 LTS
6.0
6.1

Django 6.x requires Python 3.12 or newer.

Django 5.0 and 5.1 are no longer covered by CI (both reached end of life upstream), but the package does not use any API removed in those series and the declared dependency is still django>=4.2, so they keep working.

Installation

Using uv (recommended)

uv add django-password-policies-iplweb

Using pip

pip install django-password-policies-iplweb

Quick start

Add to your Django settings:

INSTALLED_APPS = [
    ...
    "password_policies",
]

MIDDLEWARE = [
    ...
    "password_policies.middleware.PasswordChangeMiddleware",
]

TEMPLATES = [
    {
        ...
        "OPTIONS": {
            "context_processors": [
                ...
                "password_policies.context_processors.password_status",
            ],
        },
    },
]

Run migrations:

python manage.py migrate password_policies

Include URLs:

from django.urls import include, path

urlpatterns = [
    ...
    path("password/", include("password_policies.urls")),
]

Documentation

Full documentation is published at https://iplweb.github.io/django-password-policies-iplweb/ and rebuilt from develop on every push.

To build the docs locally:

uv sync --all-extras
uv run sphinx-build -b html docs docs/_build/html

License

BSD-3-Clause — see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_password_policies_iplweb-0.9.4.tar.gz (98.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_password_policies_iplweb-0.9.4-py3-none-any.whl (188.6 kB view details)

Uploaded Python 3

File details

Details for the file django_password_policies_iplweb-0.9.4.tar.gz.

File metadata

File hashes

Hashes for django_password_policies_iplweb-0.9.4.tar.gz
Algorithm Hash digest
SHA256 e2c02f7f288db169af93574b30117eaccc61e9f7ddab5989254f30230de31c47
MD5 1cc0607aae68404aaa17d05765f0ec46
BLAKE2b-256 b284b8f652879a3913ca1555f023e8b3912c862e48fd7a00721924778037d3f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_password_policies_iplweb-0.9.4.tar.gz:

Publisher: publish.yml on iplweb/django-password-policies-iplweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_password_policies_iplweb-0.9.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_password_policies_iplweb-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f45efc494fb407182865957965e3677dfd00248210da5c7b4e8e5e848a6ae89a
MD5 020ab66881cd541493b68039443eed42
BLAKE2b-256 af003887ed604d6693aff3c87901616f5b1fcbe93cf8a4ddb81bff30c24a7a37

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_password_policies_iplweb-0.9.4-py3-none-any.whl:

Publisher: publish.yml on iplweb/django-password-policies-iplweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page