开源软件名称:relekang/django-nopassword开源软件地址:https://github.com/relekang/django-nopassword开源编程语言:Python 98.4%开源软件介绍:django-nopasswordAuthentication backend for django that uses a one time code instead of passwords. This project was originally inspired by Is it time for password-less login? by Ben Brown InstallationRun this command to install django-nopassword
RequirementsDjango >= 1.11 (custom user is supported) UsageAdd the app to installed apps INSTALLED_APPS = (
...
'nopassword',
...
) Add the authentication backend EmailBackend AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `nopassword`
'django.contrib.auth.backends.ModelBackend',
# Send login codes via email
'nopassword.backends.email.EmailBackend',
) Add urls to your urls.py urlpatterns = patterns('',
...
url(r'^accounts/', include('nopassword.urls')),
...
) REST APITo use the REST API, djangorestframework must be installed
Add rest framework to installed apps INSTALLED_APPS = (
...
'rest_framework',
'rest_framework.authtoken',
'nopassword',
...
) Add TokenAuthentication to default authentication classes REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
)
} Add urls to your urls.py urlpatterns = patterns('',
...
url(r'^api/accounts/', include('nopassword.rest.urls')),
...
) You will have the following endpoints available:
SettingsInformation about the available settings can be found in the docs TestsRun with MIT © Rolf Erik Lekang |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论