Skip to main content

django-j2fa

2-factor SMS authentication for Django projects.

Install

  1. Add 'j2fa' to project settings INSTALLED_APPS
  2. Add j2fa.middleware.Ensure2FactorAuthenticatedMiddleware to project settings MIDDLEWARE (after session middleware)
  3. 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
  4. Set project settings SMS_TOKEN and SMS_SENDER_NAME
  5. 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 .

Metadata

Release files for django-j2fa 3.9.6

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-j2fa 3.9.6
File Size Uploaded Provenance Actions
django_j2fa-3.9.6.tar.gz 45.4 kB Without provenance Details for django_j2fa-3.9.6.tar.gz

Release files / django_j2fa-3.9.6.tar.gz

Download URL django_j2fa-3.9.6.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
12a4601db360fc4a69856e1cda13ce2f4c57489436265c1839dc59879444942b
BLAKE2b-256 checksum
How to use checksums
ee744b64d00ce5248d109a37f8876443e62f399e57e81ab5bb36bae7cac2430d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for django-j2fa 3.9.6

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.

Release history Release notifications | RSS feed

This release

3.9.6 This release

1 release file No provenance

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