Skip to main content

Django password rotation app

This app provides configurable rotation of passwords.

Features

  • Configurable password duration and warning duration
  • Visual warning to user using Django messages
  • Prevents user from accessing any page in after expiration unless the password is changed
  • Forces the new password to be different from previously used passwords
  • Prevents similar passwords (ex: "password1", "password2", ...)

Requirements

This Django app requires Python >= 3.8 and has been tested with Django 4.2, 5.1 and 5.2.

Installation

  1. pip install django-password-rotate.
  2. Add password_rotate to INSTALLED_APPS.
  3. Add 'password_rotate.middleware.PasswordRotateMiddleware' to MIDDLEWARE. It should be listed after authentication and session middlewares.
  4. Add password_rotate.validators.NotPreviousPasswordValidator to AUTH_PASSWORD_VALIDATORS:
AUTH_PASSWORD_VALIDATORS = [
...
{
    "NAME": "password_rotate.validators.NotPreviousPasswordValidator",
},
]
  1. Add the pattern in the urls of your project:
urlpatterns = [
    ...
    path("password_rotate/", include("password_rotate.urls")),
]
  1. Configure the app in your settings:
    # rotate passwords after 90 days
    PASSWORD_ROTATE_SECONDS = 90 * 24 * 60 * 60
    # start warning 10 days before expiration
    PASSWORD_ROTATE_WARN_SECONDS = 10 * 24 * 60 * 60
    # keep at most the 3 previous (encrypted) passwords
    PASSWORD_ROTATE_HISTORY_COUNT = 3
    # when changing the password, allow only a new password with similarity ratio greater than 50
    PASSWORD_ROTATE_MAX_SIMILARITY_RATIO = 50
    
  2. Run python manage.py migrate to create the required database tables.

If you want to exclude superusers from the password expiration, set this flag:

PASSWORD_ROTATE_EXCLUDE_SUPERUSERS = True

Acknowledgements

This app is a direct modification of:

Metadata

Release files for django-password-rotate 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-password-rotate 1.0.2
File Size Uploaded Provenance Actions
django_password_rotate-1.0.2.tar.gz 12.4 kB Without provenance Details for django_password_rotate-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-password-rotate 1.0.2
File Interpreter ABI Platform Actions
django_password_rotate-1.0.2-py3-none-any.whl Python 3 none any Details for django_password_rotate-1.0.2-py3-none-any.whl

Total release size: 29.4 kB

Release files / django_password_rotate-1.0.2.tar.gz

Download URL django_password_rotate-1.0.2.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
14143631fc7b0f17e2573a24bd677ac0ead297f133584023829d0fda728384ad
BLAKE2b-256 checksum
How to use checksums
b1ff2e00e926e17467d015bbad654fd524739d1c1b8e718fb959f5464115c257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.15

Release files / django_password_rotate-1.0.2-py3-none-any.whl

Download URL django_password_rotate-1.0.2-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c0f8a250bcb77f53a7f502298e918ce8a092af3fc7d62c1a1f28db40f4687b2
BLAKE2b-256 checksum
How to use checksums
323f9ffaceb601c2ed8493123bb9b987ddbc17a60c4f55f31551ff146cdd0b4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.15

Security for django-password-rotate 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page