Skip to main content

Django Admin Two Factor Authentication

Project description

Django Admin Two-Factor Authentication

Django Admin Two-Factor Authentication, allows you to login django admin with google authenticator.


Why Django Admin Two-Factor Authentication?

  • Using google authenticator to login your Django admin.
  • Used jquery confirm dialog to get code.
  • Simple interface
  • Easy integration

Django Admin Two-Factor Auth


How to use it

  • Download and install last version of Django Admin Two-Factor Authentication:
$ pip install django-admin-two-factor
# or
$ easy_install django-admin-two-factor
  • Add 'admin_two_factor' application to the INSTALLED_APPS setting of your Django project settings.py file (note it should be before 'django.contrib.admin'):
INSTALLED_APPS = (
'admin_two_factor.apps.TwoStepVerificationConfig',
'django.contrib.admin',
# ...
)
  • Migrate admin_two_factor:
$ python manage.py migrate admin_two_factor
$ # or
$ python manage.py syncdb
  • Add ‍‍‍‍ADMIN_TWO_FACTOR_NAME in your settings.py. This value will be displayed in Google Authenticator.
ADMIN_TWO_FACTOR_NAME = 'PROJECT_NAME'
  • Include the Admin Two Factor URL config in PROJECT_CORE/urls.py:
urlpatterns = [
path('admin/', admin.site.urls),
path('two_factor/', include(('admin_two_factor.urls', 'admin_two_factor'), namespace='two_factor')),
# ...
]
  • Collect static if you are in production environment:
$ python manage.py collectstatic
  • Clear your browser cache

Start the app

$ # Set up the database
$ python manage.py makemigrations
$ python manage.py migrate
$
$ # Create the superuser
$ python manage.py createsuperuser
$
$ # Start the application (development mode)
$ python manage.py runserver # default port 8000
  • Access the admin section in the browser: http://127.0.0.1:8000/

ScreenShoots


  • User List: the users who have enabled two-factor auth

Django Admin Two-Factor Auth: User List


  • Add New User:

Django Admin Two-Factor Auth: Add New User


  • Scan QRCode and enter the valid code:

Django Admin Two-Factor Auth: Scan QRCode


Django Admin Two-Factor Auth: Login with Code

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

django-admin-two-factor-0.1.1.tar.gz (60.3 kB view hashes)

Uploaded Source

Built Distribution

django_admin_two_factor-0.1.1-py3-none-any.whl (67.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page