OBytes django application for managing OTP (OneTruePairing) for authentication, registration and changing phone number.
Project description
OBytes Django OTP App
OTP is a Django app to conduct Web-based one true pairing, for authentication, registration and changing phone number.
Quick start
-
Install
ob_dj_otp
latest versionpip install ob_dj_otp
-
Add "ob_dj_otp" to your
INSTALLED_APPS
setting like this:
# settings.py
INSTALLED_APPS = [
...
"ob_dj_otp.core.otp",
]
# Setting Twilio as SMS Provider
OTP_PROVIDER = os.environ.get("OTP_PROVIDER", "twilio")
# Passing Twilio Verify Service-ID
OTP_TWILIO_SERVICE = os.environ.get("OTP_PROVIDER")
- Include the OTP URLs in your project urls.py like this::
# urls.py
path("otp/", include("ob_dj_otp.apis.otp.urls")),
- Run
python manage.py migrate
to create the otp models.
Extending API Serializers
OTP Verification serializer can be extended as following:
# utils.py
from ob_dj_otp.apis.otp.serializers import OTPVerifyCodeSerializer
from rest_framework import serializers
class NewOTPVerifyCodeSerializer(OTPVerifyCodeSerializer):
# write_only is required to prevent errors when reading from OTP Object for the attr
email = serializers.CharField(max_length=100, required=True, write_only=True)
class Meta:
fields = OTPVerifyCodeSerializer.Meta.fields + ("email",)
model = OTPVerifyCodeSerializer.Meta.model
# add path to Serializer to django settings
OTP_VERIFICATION_SERIALIZER = "full.path.NewOTPVerifyCodeSerializer"
Developer Guide
-
Clone github repo
git clone [url]
-
pipenv install --dev
-
pre-commit install
-
Run unit tests
pytest
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
ob-dj-otp-0.0.14.tar.gz
(58.4 kB
view details)
Built Distribution
File details
Details for the file ob-dj-otp-0.0.14.tar.gz
.
File metadata
- Download URL: ob-dj-otp-0.0.14.tar.gz
- Upload date:
- Size: 58.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4afe3e8b3d9aa18e42347ff84e9ee87beab9875af3d7691aa02b8b53a007347 |
|
MD5 | 5e881a08856dd4e5e85a9f543f1cd8b2 |
|
BLAKE2b-256 | af4a151b66e9e6824fdfd1d2bbcac20a450e039290f7eaafcefa923e6cfeed47 |
File details
Details for the file ob_dj_otp-0.0.14-py3-none-any.whl
.
File metadata
- Download URL: ob_dj_otp-0.0.14-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5790f4d84212d4ea4061dec2911c396e7c4271f35d5b632c5a5061e500b4988 |
|
MD5 | dcd3a330bf071e0dccac31b90361bcd5 |
|
BLAKE2b-256 | 8433bc5bfa4012b43dd7e4bfeed3dd048b56a0a0b6e91a8c7fbf0cf6cc0f9462 |