Metadata-Version: 2.0
Name: django-phone-login
Version: 1.1.3
Summary: Django Phone Login: Login with OTP
Home-page: https://github.com/gonnamake/django-phone-login
Author: Ray Ch
Author-email: ray@jhink.com
License: BSD License
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Dist: django-phonenumber-field (==1.1.0)
Requires-Dist: django-sendsms (==0.2.3)

|build-status-image| |pypi-version|

Django Phone Login
==================

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.

Installing Django Phone Login
-----------------------------

Django Phone Login was built for django.

PyPi, install using PIP:

.. code:: bash

    pip install django-phone-login

If you want to install manually:

.. code:: bash

    git clone git@github.com:wejhink/django-phone-login.git
    cd django-phone-login/
    pip install -r requirements.txt
    python setup.py install

Instructions
------------

.. code:: python

    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' 

Adding to URLs
--------------

Add the Below ``urls.py``

.. code:: python

    urlpatterns = [
        url(r'^phone_login/', include('phone_login.urls', namespace='phone_login'),),
    ]

Customizable Fields in Settings.
--------------------------------

.. code:: python

    PHONE_LOGIN_ATTEMPTS = 10
    PHONE_LOGIN_OTP_LENGTH = 6
    PHONE_LOGIN_OTP_HASH_ALGORITHM = 'sha256'

Flow
====

1. User enter the ``phone_number`` and sends request to generate
   ``secret code``.
2. ``django-phone-login`` sends a ``secret_code`` as SMS to the phone
   number.
3. User sends ``secret_code`` to the server to verify.
4. ``django-phone-login`` verifies and send ``token`` as response using
   ``DRF3``.

Why use django-phone-login?
---------------------------

-  Phone number login, no password required.
-  Registration through phone number.
-  Mobile based user authentication.

.. |build-status-image| image:: https://secure.travis-ci.org/wejhink/django-phone-login.svg?branch=master
   :target: http://travis-ci.org/wejhink/django-phone-login?branch=master
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-phone-login.svg
   :target: https://pypi.python.org/pypi/django-phone-login


