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

Overview

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

You might also like...
Beihang University Network Authentication Login

北航自动网络认证使用说明 主文件 gw_buaa.py # @file gw_buaa.py # @author Dong # @date 2022-01-25 # @email [email protected] # @brief This is a python script to l

Mock authentication API that acceccpts email and password and returns authentication result.

Mock authentication API that acceccpts email and password and returns authentication result.

Django CAS 1.0/2.0/3.0 client authentication library, support Django 2.0, 2.1, 2.2, 3.0 and Python 3.5+

django-cas-ng django-cas-ng is Django CAS (Central Authentication Service) 1.0/2.0/3.0 client library to support SSO (Single Sign On) and Single Logou

Login System Using Django

Login System Django

A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

REST implementation of Django authentication system.
REST implementation of Django authentication system.

djoser REST implementation of Django authentication system. djoser library provides a set of Django Rest Framework views to handle basic actions such

Authentication Module for django rest auth

django-rest-knox Authentication Module for django rest auth Knox provides easy to use authentication for Django REST Framework The aim is to allow for

Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

JSON Web Token Authentication support for Django REST Framework

REST framework JWT Auth Notice This project is currently unmaintained. Check #484 for more details and suggested alternatives. JSON Web Token Authenti

Comments
  • Forbidden (CSRF token from the 'X-Csrftoken' HTTP header has incorrect length.): /two_factor/verification/

    Forbidden (CSRF token from the 'X-Csrftoken' HTTP header has incorrect length.): /two_factor/verification/

    Hi

    Thank you for your job.

    It was working perfectly on my dev environment but not on production. I think the difference is that I am using everything very secure:

    SESSION_COOKIE_SECURE="True"
    SESSION_COOKIE_HTTPONLY="True"
    CSRF_COOKIE_HTTPONLY="True"
    SECURE_BROWSER_XSS_FILTER="True"
    DJANGO_SECURE_SSL_REDIRECT="True"
    X_FRAME_OPTIONS="DENY"
    

    In the log I get Forbidden (CSRF token from the 'X-Csrftoken' HTTP header has incorrect length.): /two_factor/verification/

    When I inspect the request in the browser on the PUT request, in the request header I have : x-csrftoken: undefined

    I am not sure but may be this is a way : https://docs.djangoproject.com/fr/4.0/ref/csrf/#setting-the-token-on-the-ajax-request

    Also you may add in the documentation to allow PUT request on the webserver for this URL /two_factor/verification/.

    opened by pulse-mind 1
  • (fields.E301) Field defines a relation with the model 'auth.User'

    (fields.E301) Field defines a relation with the model 'auth.User'

    Hello, Please add support for Django custom User model. model.py replace line 8

    from django.contrib.auth.models import User

    with from django.contrib.auth import get_user_model

    line 15 User = get_user_model()

    I tested it pass ok with migrate

    Im not 100% sure if it fully works like this or need more modifications

    opened by residentcode 3
Releases(v0.0.2)
Owner
Iman Karimi
Experienced web developer with a demonstrated history of working in the web related service and applications industry.
Iman Karimi
OAuthlib support for Python-Requests!

Requests-OAuthlib This project provides first-class OAuth library support for Requests. The OAuth 1 workflow OAuth 1 can seem overly complicated and i

1.6k Dec 28, 2022
An introduction of Markov decision process (MDP) and two algorithms that solve MDPs (value iteration, policy iteration) along with their Python implementations.

Markov Decision Process A Markov decision process (MDP), by definition, is a sequential decision problem for a fully observable, stochastic environmen

Yu Shen 31 Dec 30, 2022
A Python tool to generate and refresh Amazon access tokens.

amazon_auth A Python tool to generate and refresh Amazon access tokens. Description This tool generates and outputs Amazon access and refresh tokens f

15 Nov 21, 2022
Two factor authentication system using azure services and python language and its api's

FUTURE READY TALENT VIRTUAL INTERSHIP PROJECT PROJECT NAME - TWO FACTOR AUTHENTICATION SYSTEM Resources used: * Azure functions(python)

BHUSHAN SATISH DESHMUKH 1 Dec 10, 2021
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 Single- and multi-tenant support.

Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 Single- and multi-tenant support.

Intility 220 Jan 05, 2023
Automatizando a criação de DAGs usando Jinja e YAML

Automatizando a criação de DAGs no Airflow usando Jinja e YAML Arquitetura do Repo: Pastas por contexto de negócio (ex: Marketing, Analytics, HR, etc)

Arthur Henrique Dell' Antonia 5 Oct 19, 2021
Library - Recent and favorite documents

Thingy Thingy is used to quickly access recent and favorite documents. It's an XApp so it can work in any distribution and many desktop environments (

Linux Mint 23 Sep 11, 2022
A module making it easier to manage Discord oAuth with Quart

quart_discord A module making it easier to manage Discord oAuth with Quart Install pip install git+https://github.com/xelA/ 5 Oct 27, 2022

This is a Python library for accessing resources protected by OAuth 2.0.

This is a client library for accessing resources protected by OAuth 2.0. Note: oauth2client is now deprecated. No more features will be added to the l

Google APIs 787 Dec 13, 2022
:couple: Multi-user accounts for Django projects

django-organizations Summary Groups and multi-user account management Author Ben Lopatin (http://benlopatin.com) Status Separate individual user ident

Ben Lopatin 1.1k Jan 09, 2023
Beihang University Network Authentication Login

北航自动网络认证使用说明 主文件 gw_buaa.py # @file gw_buaa.py # @author Dong # @date 2022-01-25 # @email windcicada 0 Jul 22, 2022

OAuth2 goodies for the Djangonauts!

Django OAuth Toolkit OAuth2 goodies for the Djangonauts! If you are facing one or more of the following: Your Django app exposes a web API you want to

Jazzband 2.7k Dec 31, 2022
RSA Cryptography Authentication Proof-of-Concept

RSA Cryptography Authentication Proof-of-Concept This project was a request by Structured Programming lectures in Computer Science college. It runs wi

Dennys Marcos 1 Jan 22, 2022
Includes Automation and Personal Projects

Python Models, and Connect Forclient & OpenCv projects Completed Automation** Alarm (S

tushar malhan 1 Jan 15, 2022
Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.

Django Two-Factor Authentication Complete Two-Factor Authentication for Django. Built on top of the one-time password framework django-otp and Django'

Bouke Haarsma 1.3k Jan 04, 2023
A secure authentication module to validate user credentials in a Streamlit application.

Streamlit-Authenticator A secure authentication module to validate user credentials in a Streamlit application. Installation Streamlit-Authenticator i

M Khorasani 336 Dec 31, 2022
Login System Using Django

Login System Django

Nandini Chhajed 6 Dec 12, 2021
OpenConnect auth creditials collector.

OCSERV AUTH CREDS COLLECTOR V1.0 Зачем Изначально было написано чтобы мониторить какие данные вводятся в интерфейс ханипота в виде OpenConnect server.

0 Sep 23, 2022
Provide OAuth2 access to your app

django-oml Welcome to the documentation for django-oml! OML means Object Moderation Layer, the idea is to have a mixin model that allows you to modera

Caffeinehit 334 Jul 27, 2022
Connect-4-AI - AI that plays Connect-4 using the minimax algorithm

Connect-4-AI Brief overview I coded up the Connect-4 (or four-in-a-row) game in

Favour Okeke 1 Feb 15, 2022