## OBytes Django OTP App
[![Build & Test](https://github.com/obytes/ob-dj-otp/workflows/Build%20&%20Test/badge.svg)](https://github.com/obytes/ob-dj-otp/actions)
[![pypi](https://img.shields.io/pypi/v/ob-dj-otp.svg)](https://pypi.python.org/pypi/ob-dj-otp)
[![license](https://img.shields.io/badge/License-BSD%203%20Clause-green.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![downloads](https://pepy.tech/badge/ob-dj-otp)](https://pepy.tech/project/ob-dj-otp)
[![python](https://img.shields.io/pypi/pyversions/ob-dj-otp.svg)](https://pypi.python.org/pypi/ob-dj-otp)
[![docs](https://github.com/obytes/ob-dj-otp/workflows/Docs/badge.svg)](https://github.com/obytes/ob-dj-otp/blob/main/docs/source/index.rst)
[![health-check](https://snyk.io/advisor/python/ob-dj-otp/badge.svg)](https://snyk.io/advisor/python/ob-dj-otp)
OTP is a Django app to conduct Web-based one true pairing, for authentication, registration and changing phone number.
## Quick start
1. Install `ob_dj_otp` latest version `pip install ob_dj_otp`
2. Add "ob_dj_otp" to your `INSTALLED_APPS` setting like this:
```python
# 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")
```
3. Include the OTP URLs in your project urls.py like this::
```python
# urls.py
path("otp/", include("ob_dj_otp.apis.otp.urls")),
```
4. Run ``python manage.py migrate`` to create the otp models.
### Extending API Serializers
OTP Verification serializer can be extended as following:
```python
# 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
1. Clone github repo `git clone [url]`
2. `pipenv install --dev`
3. `pre-commit install`
4. Run unit tests `pytest`
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:ob-dj-otp-0.0.10.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
ob-dj-otp-0.0.10.tar.gz (65个子文件)
ob-dj-otp-0.0.10
MANIFEST.in 30B
PKG-INFO 3KB
config
wsgi.py 387B
__init__.py 0B
settings.py 11KB
urls.py 200B
docs
make.bat 763B
Makefile 637B
source
conf.py 1KB
models.rst 141B
admin.rst 91B
installation.rst 1KB
rest_endpoints.rst 2KB
index.rst 448B
pytest.ini 185B
Pipfile 1KB
.github
dependabot.yml 273B
workflows
docs.yml 945B
test-build.yml 987B
release.yml 2KB
pre-release.yml 1KB
Dockerfile 1KB
ob_dj_otp.egg-info
PKG-INFO 3KB
requires.txt 34B
SOURCES.txt 2KB
top_level.txt 10B
dependency_links.txt 1B
.isort.cfg 185B
Pipfile.lock 91KB
setup.cfg 908B
docker-compose.yml 787B
setup.py 517B
manage.py 1KB
.gitignore 160B
Makefile 2KB
README.md 2KB
ob_dj_otp
core
__init__.py 0B
otp
models.py 2KB
managers.py 787B
app_settings.py 115B
apps.py 472B
utils.py 905B
__init__.py 462B
migrations
__init__.py 0B
0001_initial.py 2KB
providers
twilio.py 461B
__init__.py 752B
settings_validation.py 2KB
admin.py 394B
tasks.py 461B
users
models.py 2KB
managers.py 679B
apps.py 184B
__init__.py 60B
migrations
__init__.py 0B
0001_initial.py 6KB
admin.py 29B
__init__.py 0B
apis
__init__.py 0B
otp
serializers.py 6KB
__init__.py 0B
views.py 2KB
urls.py 336B
.pre-commit-config.yaml 1KB
docker-compose.env 70B
共 65 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功