2-factor SMS authentication for Django projects.
Project description
django-j2fa
2-factor SMS authentication for Django projects.
Install
- Add 'j2fa' to project settings INSTALLED_APPS
- Add j2fa.middleware.Ensure2FactorAuthenticatedMiddleware to project settings MIDDLEWARE (after session middleware)
- Make sure user.profile.phone resolves to phone number and user.profile.require_2fa resolves to True/False. Alternatively, you can override Ensure2FactorAuthenticatedMiddleware.is_2fa_required
- Set project settings SMS_TOKEN and SMS_SENDER_NAME
- Add TwoFactorAuth.as_view() to urls with name='j2fa-obtain-auth'
Supported Settings
in settings:
SMS_TOKEN: Kajala Group (https://kajala.com) SMS API token. Contact info@kajala.com for accessSMS_SENDER_NAME: SMS sender name, max 13 charactersJ2FA_ENABLED: Enabled/disable 2FA system-wide. Default is TrueJ2FA_SEND_TO_EMAIL: Send 2FA codes also to email. Default is False.J2FA_FALLBACK_TO_EMAIL: Send 2FA codes to email if SMS sending fails. Default is False.
Static Code Analysis
The library passes both prospector and mypy checking. To install:
pip install prospector pip install mypy
To analyze:
prospector mypy .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_j2fa-3.9.6.tar.gz
(45.4 kB
view details)
File details
Details for the file django_j2fa-3.9.6.tar.gz.
File metadata
- Download URL: django_j2fa-3.9.6.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12a4601db360fc4a69856e1cda13ce2f4c57489436265c1839dc59879444942b
|
|
| MD5 |
41794440752f8c48d3909df800070944
|
|
| BLAKE2b-256 |
ee744b64d00ce5248d109a37f8876443e62f399e57e81ab5bb36bae7cac2430d
|