A Django app to authenticate and register user using phone/email/username.
Project description
django-phone-auth
A Django app to authenticate and register user using phone/email/username. It uses default User Model.
Installation
pip install django-phone-auth
Add 'phone_auth' in INSTALLED_APPS.
INSTALLED_APPS = [
...
'phone_auth'
]
Add 'phone_auth.backend.CustomAuthBackend' in AUTHENTICATION_BACKENDS.
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
...
'phone_auth.backend.CustomAuthBackend',
]
Add 'path('accounts/', include('phone_auth.urls'))' in urls.py
urlpatterns = [
...
path('accounts/', include('phone_auth.urls'))
]
Now run command -
python manage.py migrate
Usage
On registration page ('accounts/register/') by default first_name, last_name, email and username is optional. These can be set to required by adding following variables in settings.py
REGISTER_USERNAME_REQUIRED = True
REGISTER_EMAIL_REQUIRED = True
REGISTER_FNAME_REQUIRED = True
REGISTER_LNAME_REQUIRED = True
On login page ('accounts/login/') by default user can only login with phone. To allow login through username/email/phone add following in settings.py
LOGIN_METHODS = {'email', 'phone', 'username'}
Note: LOGIN_METHODS can't be empty
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_phone_auth-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b4e7c9820bf6d679ff58e4a08f8f4938b05c0ccedc819ef2b5a3bd856c004f |
|
MD5 | a6095d8dda39f93be97a91e63b4ae4c4 |
|
BLAKE2b-256 | 2e7ff4418dd12d5b906e8be15c849165b051c5b2c3aec4e2b61c8fac2a5a06d5 |