Django-phone-login uses django-sendsms to send sms.
Django Phone Login provides phone number login with no additional passwords to remember. It's a easy way to grow your customer base. Without any hassle.
Django Phone Login was built for django.
PyPi, install using PIP:
pip install django-phone-login
If you want to install manually:
git clone git@github.com:wejhink/django-phone-login.git
cd django-phone-login/
pip install -r requirements.txt
python setup.py install
INSTALLED_APPS += [
... # Make sure to include the default installed apps here.
'phone_login',
'rest_framework',
'rest_framework.authtoken',
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.TokenAuthentication',
)
}
AUTHENTICATION_BACKENDS = [
'phone_login.backends.phone_backend.PhoneBackend',
'django.contrib.auth.backends.ModelBackend'
]
# Make sure you also have backend Django Templates and APP_DIRS True, if you want to use default OTP Template.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
...
},
]
# Configure the SENDSMS_BACKEND (for django-sendsms integration)
SENDSMS_BACKEND = 'myapp.mysmsbackend.SmsBackend' #(defaults to 'sendsms.backends.console.SmsBackend')
SENDSMS_FROM_NUMBER = "+XXxxxxxxxxxx"
SENDSMS_ACCOUNT_SID = 'ACXXXXXXXXXXXXXX'
SENDSMS_AUTH_TOKEN = 'xxxxxxxx'
Add the Below urls.py
urlpatterns = [
url(r'^phone_login/', include('phone_login.urls', namespace='phone_login'),),
]
PHONE_LOGIN_ATTEMPTS = 10
PHONE_LOGIN_OTP_LENGTH = 6
PHONE_LOGIN_OTP_HASH_ALGORITHM = 'sha256'
PHONE_LOGIN_DEBUG = True # will include otp in generate response, default is False.
- User enter the
phone_number
and sends request to generatesecret code
. django-phone-login
sends asecret_code
as SMS to the phone number.- User sends
secret_code
to the server to verify. django-phone-login
verifies and sendtoken
as response usingDRF3
.
- Phone number login, no password required.
- Registration through phone number.
- Mobile based user authentication.