2-Factor Authentication for Django projects
Project description
django-j2fa
2-factor SMS authentication for Django projects. Supports Django 3.x and 4.x.
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 access * SMS_SENDER_NAME: SMS sender name, max 13 characters * J2FA_ENABLED: Enabled/disable 2FA system-wide. Default is True * J2FA_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
File details
Details for the file django-j2fa-3.8.10.tar.gz
.
File metadata
- Download URL: django-j2fa-3.8.10.tar.gz
- Upload date:
- Size: 47.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6111c95dbd0e4e24a98700c666ad3e46c2aca8a34b590f1b272f455c3e0a1c0 |
|
MD5 | 8225101aee2cdf4847d5cebc2d8bb97e |
|
BLAKE2b-256 | 2cf4de011a3348000156af6fcf46da1e8718fceb3f210ca5dcd1d6ec0f8425c2 |