Skip to main content
=============================
verification
=============================

.. image:: https://travis-ci.org/Fueled/django-user-verification.png?branch=master
:target: https://travis-ci.org/Fueled/django-user-verification

Package to help out with verifying new users.

Documentation
-------------

The full documentation is at https://django-user-verification.readthedocs.org.

Quickstart
----------

Install verification::

pip install django-user-verification

Then use it in a project::

import verification

Usage
--------

Defining Environment Variables for Backend
===========================================

In your settings file (e.g. common.py), define your credentials and any environment variables required for your backend service (e.g. Sendgrid, Twilio). This is how django-user-verification will actually send its verification link to whichever clients.

Also, add "verification" in your **INSTALLED_APPS** that's in your settings file.

For example, we define backend env variables in our settings file for Phone (Twilio) and Email:

.. code-block:: python

USER_VERIFICATION = {
'phone': {
'BACKEND': 'verification.backends.twilio.TwilioBackend',
'OPTIONS': {
'SID': os.getenv('TWILIO_API_SID'),
'SECRET': os.getenv('TWILIO_API_SECRET'),
'FROM': os.getenv('TWILIO_FROM'),
'MESSAGE': "Welcome, continue with this link: {link}"
},
'APP_URL': 'app://'
},
'email': {
'BACKEND': 'verification.backends.email.EmailBackend',
'OPTIONS': {
'FROM': os.getenv('FROM_EMAIL', default='dummy@fueled.com')
},
'APP_URL': 'app://'
},

}

Then, go to your `urls.py` file and insert the following in your `urlpatterns`:

.. code-block:: python

url(r'^verification/', include("verification.urls")),


An example `POST` request for sending to a phone number:

``/verify/send/phone/``

and the payload being:

{
"email": "joe@doe.com"
}


Another example request for sending to an email is:

``/verify/send/email/``

with the payload being:

{
"email": "joe@doe.com"
}


Configuration
--------------
You can user multiple verification backends, such as a `phone` or `email` backend. Inside these verification types we can set multiple `OPTIONS`, for example we could set up the `phone` verification type:

.. code::
USER_VERIFICATION = {
'phone': {
'BACKEND': 'verification.backends.twilio.TwilioBackend',
'OPTIONS': {
'SID': os.getenv('TWILIO_API_SID'),
'SECRET': os.getenv('TWILIO_API_SECRET'),
'FROM': os.getenv('TWILIO_FROM'),
'MESSAGE': "Welcome, continue with this link: {link}"
},
'APP_URL': 'app://',
'GENERATOR': 'verification.generators.NumberGenerator'
}
}


**BACKEND**: The import path of a verification type. There are multiple verification backends available:
- `verification.backends.twilio.TwilioBackend`: Twilio backend for sending SMS, needs `SID`, `SECRET`, `FROM` and optionally `MESSAGE`
- `verification.backends.email.EmailBackend`: Email backend, uses Django default email handler, no options needed

**OPTIONS**: These are options specific for the backend

**APP_URL**: The App URL to redirect to, currently iOS Only

**GENERATOR**: The generator of the keys that are stored in the cache, default it is a 5 digit number

Verification
-----------------
This package solely creates a way to verify a phone number or email, but we decided we wanted to be able to add additional resources to the verification process, such as registration when pin number is correct. For that we made a serializer for you to use, which handles the validation of the pin for you.

To use the serializer we just have to extend the `verification.serializers.VerificationSerializer`, like so:

.. code-block:: python
class MyOwnVerificationSerializer(VerificationSerializer):
email = serializers.CharField()
token = serializers.CharField()

class Meta:
verification_type = 'email'
token_field = 'token'

**NOTE**: We have to add `verification_type` as minimum so that we know which flow we are using (e.g. `email` or `phone`)



Running Tests
--------------

Does the code actually work?

.. code-block:: bash

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-test.txt
(myenv) $ python runtests.py

Contributing
--------------
Feel free to create issues or open pull requests, we would love to see your contributions coming in!




History
-------

0.1.0 (2016-02-01)
++++++++++++++++++

* First release on PyPI.

Metadata

Release files for django-user-verification 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-user-verification 0.1.2
File Size Uploaded Provenance Actions
django-user-verification-0.1.2.tar.gz 10.9 kB Without provenance Details for django-user-verification-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-user-verification 0.1.2
File Interpreter ABI Platform Actions
django_user_verification-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_user_verification-0.1.2-py2.py3-none-any.whl

Total release size: 34.5 kB

Release files / django-user-verification-0.1.2.tar.gz

Download URL django-user-verification-0.1.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00ff6e5f3db01b5dba638254682b1bdee1a9dcfe56c1cddb1d7740a87682fef9
BLAKE2b-256 checksum
How to use checksums
2a31d70af97997dc6b65415f0bebebbbb8003ddc8eac4cbe2ea14b8acf6053f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_user_verification-0.1.2-py2.py3-none-any.whl

Download URL django_user_verification-0.1.2-py2.py3-none-any.whl
Size 23.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
057f01601400ff695c69c79e375e4c419b79c3add76f2cefa0ae6278a4a71574
BLAKE2b-256 checksum
How to use checksums
2fdadd2b75ffc7e566db3237b80db651d07ba0871d3c48cff966a1e3c6deacba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-user-verification 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page