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.11.tar.gz
(25.7 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.11.tar.gz.
File metadata
- Download URL: django_moses-0.12.11.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330c971908ac62cb9a86f733f7bba35a0c47d7bc147461d97105e95d60838071
|
|
| MD5 |
3e5b218701243d5b6eaa36c0c064c146
|
|
| BLAKE2b-256 |
e5bd8b7d0b17d9b5eb16445a343df69234368d647f80f629cdf5d60827a8d16c
|
File details
Details for the file django_moses-0.12.11-py3-none-any.whl.
File metadata
- Download URL: django_moses-0.12.11-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee430120a8de052c9835ffb557e423297faaef9e1389b332c4ea0e1fc26157b8
|
|
| MD5 |
a1e2560b328f5f0386df4e77dd831bf8
|
|
| BLAKE2b-256 |
a9abd6129a02c2f77b7fc5d599ef2f16a0fc6864f45329d8b048637b3d92eb57
|