Metadata-Version: 2.4
Name: django-j2fa
Version: 3.9.5
Summary: 2-factor SMS authentication for Django projects.
Author-email: Jani Kajala <kajala@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/kajala/django-j2fa
Project-URL: Issues, https://github.com/kajala/django-j2fa/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: Django>=2.1.7
Requires-Dist: django-ipware>=3.0.0
Requires-Dist: requests>=2.19.1
Dynamic: license-file

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 .
