Django app for forcing password rotation
Project description
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
pip install django-password-rotate.- Add
password_rotatetoINSTALLED_APPS. - Add
'password_rotate.middleware.PasswordRotateMiddleware'toMIDDLEWARE. It should be listed after authentication and session middlewares. - Add
password_rotate.validators.NotPreviousPasswordValidatortoAUTH_PASSWORD_VALIDATORS:
AUTH_PASSWORD_VALIDATORS = [
...
{
"NAME": "password_rotate.validators.NotPreviousPasswordValidator",
},
]
- Add the pattern in the urls of your project:
urlpatterns = [
...
path("password_rotate/", include("password_rotate.urls")),
]
- 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
- Run
python manage.py migrateto 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:
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
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_password_rotate-1.0.0.tar.gz.
File metadata
- Download URL: django_password_rotate-1.0.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b1cbbbec7a3ea74bee859078f298a7805fe261ca6ab24d9d5d4a6f59d36151e
|
|
| MD5 |
f7d814d1d5d82f3a78d694e27101b919
|
|
| BLAKE2b-256 |
c9b06b9cbde3e6f6e62aaab87e41850f49bfe3c23c34db196d2080963a9e9faa
|
File details
Details for the file django_password_rotate-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_password_rotate-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7ff0cc7ddc1dc2412b879c57fcb3b9560a4c59b86f072e80e94a7cf72332ce2
|
|
| MD5 |
6664cc1651aa8097bd08d24358c97646
|
|
| BLAKE2b-256 |
67c06d1d06472b1db44b1e2cd71f93ae2a904fc9e36d30632f9f0bb92556bd1f
|