Skip to main content

A Django application to implement password policies.

Project description

django-password-policies-iplweb

Tests 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.0
5.1

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")),
]

License

BSD-3-Clause — see LICENSE for details.

Project 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.0.tar.gz (91.1 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.0-py3-none-any.whl (185.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_password_policies_iplweb-0.9.0.tar.gz
Algorithm Hash digest
SHA256 4ea38dd5d261e7e7c8694fd8447ca9ce7bceb51a6efac5a609870d81bcadfd43
MD5 8cb34b0d5cfa96a9b7142c2c77c9b95f
BLAKE2b-256 f3df7b934230c45c74b0c8baa419d99aeb18edb5dbc8526ab79a77a4b7fe0a07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_password_policies_iplweb-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b702e17dd80b83e06c7247f6949c5f2c3297b49ac2996be4388049cc49016ab
MD5 146cbe6bb82357ce30c7896d8c6715aa
BLAKE2b-256 f83653dd874280b1223015e1eaa79c21c0131b4d2f6512686e6f8723cdd3c6c5

See more details on using hashes here.

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