Advanced authentication with OTP and phone number verification
Project description
Moses
Moses is the Django app that provides OTP authentication and phone number email verification by 6-digit verification codes.
Quick start
- Add "moses" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'moses',
'django.contrib.admin',
...
]
- Set moses's CustomUser model as AUTH_USER_MODEL::
AUTH_USER_MODEL = 'moses.CustomUser'
- Allow OTP header in django-cors-headers config::
CORS_ALLOW_HEADERS = (
*default_headers,
"otp",
)
- Add MFAModelBackend as Authentication backend to process OTP on authentication::
AUTHENTICATION_BACKENDS = [
'moses.authentication.MFAModelBackend',
...
]
- Add JWTAuthentication to REST_FRAMEWORK's DEFAULT_AUTHENTICATION_CLASSES::
REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': [
'moses.authentication.JWTAuthentication',
]
}
- Specify Moses's serializers for Djoser::
MOSES = {
"DEFAULT_LANGUAGE": 'en',
"SEND_SMS_HANDLER": "project.common.sms.send",
"SENDER_EMAIL": "noreply@example.com",
"PHONE_NUMBER_VALIDATOR": "project.common.sms.validate_phone_number",
"DOMAIN": DOMAIN,
"URL_PREFIX": "http://localhost:8000", # without trailing slash
"IP_HEADER": "HTTP_CF_CONNECTING_IP" if DEBUG else None,
"LANGUAGE_CHOICES": (
('en', _("English")),
),
}
- Add to your root urls.py::
from moses.admin import OTPAdminAuthenticationForm
admin.site.site_header = _('Admin Panel')
admin.site.index_title = 'Welcome'
admin.site.login_form = OTPAdminAuthenticationForm
- Run
python manage.py migrateto create the accounts models.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_moses-0.12.2.tar.gz
(19.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_moses-0.12.2.tar.gz.
File metadata
- Download URL: django_moses-0.12.2.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.4 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b58af777ffd46a8791d21101b5f61b84a2ce2c1909f16414ce625b4d956457e4
|
|
| MD5 |
f4f6398ec1c9543e269bbf3bad9a3b64
|
|
| BLAKE2b-256 |
7c65c8571b4971a6fa2130df70097c8fb5a78119126844ad8bc28ed23adf7968
|
File details
Details for the file django_moses-0.12.2-py3-none-any.whl.
File metadata
- Download URL: django_moses-0.12.2-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.4 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c6274489eb50ca38e6a85d7bc7c6c3d167b32401a8df7e026a5f9813ffc61ed
|
|
| MD5 |
49a306823682b52802f49f66c183e740
|
|
| BLAKE2b-256 |
b48aed4760379aa4fe4645fc3348f938a6a1fe98c459cb1c9902e786aee3a69d
|