Skip to main content
https://travis-ci.org/percipient/django-allauth-2fa.svg?branch=master

django-allauth-2fa adds two-factor authentication to django-allauth, a set of Django applications which help with authentication, registration, and other account management tasks.

Features

Installation

Install django-allauth-2fa with pip (note that this will install Django, django-allauth, django-otp, qrcode and all of their requirements):

pip install django-allauth-2fa

After all the pre-requisities are installed, django-allauth and django-otp must be configured in your Django settings file. (Please check the django-allauth documentation and django-otp documentation for more in-depth steps on their configuration.)

INSTALLED_APPS = (
    # Required by allauth.
    'django.contrib.sites',

    # Configure Django auth package.
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',

    # Enable allauth.
    'allauth',
    'allauth.account',

    # Configure the django-otp package.
    'django_otp',
    'django_otp.plugins.otp_totp',
    'django_otp.plugins.otp_static',

    # Enable two-factor auth.
    'allauth_2fa',
)

MIDDLEWARE_CLASSES = (
    # Configure Django auth package.
    'django.contrib.auth.middleware.AuthenticationMiddleware',

    # Configure the django-otp package. Note this must be after the
    # AuthenticationMiddleware.
    'django_otp.middleware.OTPMiddleware',

    # Reset login flow middleware. If this middleware is included, the login
    # flow is reset if another page is loaded between login and successfully
    # entering two-factor credentials.
    'allauth_2fa.middleware.AllauthTwoFactorMiddleware',
)

# Set the allauth adapter to be the 2FA adapter.
ACCOUNT_ADAPTER = 'allauth_2fa.adapter.OTPAdapter'

# Configure your default site. See
# https://docs.djangoproject.com/en/dev/ref/settings/#sites.
SITE_ID = 1

After the above is configure, you must run migrations.

python manage.py migrate

Finally, you must include the django-allauth-2fa URLs:

from django.conf.urls import include, url

urlpatterns = [
    # Include the allauth and 2FA urls from their respective packages.
    url(r'^', include('allauth_2fa.urls')),
    url(r'^', include('allauth.urls')),
]

Contribute

django-allauth-2fa was initially created by Víðir Valberg Guðmundsson (@valberg), and is currently maintained by Percipient Networks. Please feel free to contribute if you find django-allauth-2fa useful!

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.

  2. If you feel uncomfortable or uncertain about an issue or your changes, feel free to email support@percipientnetworks.com and we will happily help you.

  3. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).

  4. Write a test which shows that the bug was fixed or that the feature works as expected.

  5. Send a pull request and bug the maintainer until it gets merged and published.

The test project can be used as a minimal example using the following:

# Run the server with debug.
DJANGO_SETTINGS_MODULE=tests.run_settings python manage.py runserver_plus
# Run the shell.
DJANGO_SETTINGS_MODULE=tests.run_settings python manage.py shell_plus

Release files for django-allauth-2fa 0.4.3

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

Built distribution (wheel)

Table of built distributions (wheels) for django-allauth-2fa 0.4.3
File Interpreter ABI Platform
django_allauth_2fa-0.4.3-py2-none-any.whl Python 2 none any Details

Release files / django_allauth_2fa-0.4.3-py2-none-any.whl

Download URL django_allauth_2fa-0.4.3-py2-none-any.whl
Size 15.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
fbc58e7749e68e28a23ae4cb229486c5e7e7efeee7019825fca5dc1a640ede00
BLAKE2b-256 checksum
How to use checksums
8433316eaa12593a67d34d059758858485d05b519c03092019faaaa9cc760829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.12.0

2 release files

0.11.1

2 release files

0.9

2 release files

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4.4

1 release file

This release

0.4.3 This release

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.0.1

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