Skip to main content

Secure authentication by TOTP, SMS, Codes & Question

Project description

Code Health Codacy Python 2.7, 3.4+ Current version on PyPi Downloads from PyPi License

Module which provide secure authentication by TOTP/SMS/Codes/Question. Login protected by IP ranges and with captcha, when login attempt will fail.

Demo installation:

$ sudo apt-get install -y virtualenvwrapper redis-server git python-dev || brew install pyenv-virtualenvwrapper redis git geoip
$ source /usr/share/virtualenvwrapper/ || source /usr/local/bin/
$ mkvirtualenv django-secure-auth
$ workon django-secure-auth
$ git clone --depth 1
$ cd django-secure-auth
$ pip install -r requirements.txt
$ python develop
$ cd demo
$ pip install -r requirements.txt
$ python syncdb --noinput
$ python migrate --noinput
$ python createsuperuser --username admin --email
$ wget
$ gunzip GeoLiteCity.dat.gz
$ mkdir -p /usr/share/geoip/; mv GeoLiteCity.dat /usr/share/geoip/
$ cd ../

Open settings:

$ vim demo/

Replace Twilio credentials in AUTH_SMS_BACKEND_AUTH to your demo account settings or change SMS_FORCE to False.

Run Redis server and Celery daemon(or remove ‘djcelery’ from INSTALLED_APPS):

$ make run_redis
$ make run_celery

Run test server:

$ make run_server

Now you can open and register new account and setup all available authentication methods.

Note: activation link will be output to console.


When you are using TOTP auth method, please update your server time. If your server time is behind from real time, user cannot be authenticated by authenticator app. You can run ntpd clients, or update time on server by cron job:


# Update time
0 */6 * * * ntpdate >& /dev/null


/screenshots/login-confirmation.jpg /screenshots/settings.jpg /screenshots/two-factor-configuration.jpg /screenshots/sms-settings.jpg


  • Python: 2.7

  • Django: 1.4, 1.8, 1.11

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-secure-auth- (52.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page