Generalized app for two-step verification.
Python HTML Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
requirements Whoops, ipython certainly not needed at all times Jun 25, 2014
src Shut up warnings Mar 14, 2015
.bumpversion.cfg Version 0.4.1 Jun 13, 2016
.coveragerc Feature complete Mar 28, 2014
.gitignore Ignore packaging-artifacts Jun 13, 2016
BSDmakefile Feature complete Mar 28, 2014
CHANGELOG.rst Version 0.4 Mar 15, 2015
CONTRIBUTORS.txt Added CONTRIBUTORS.txt Jun 30, 2014
GNUmakefile Feature complete Mar 28, 2014 Include migrations Jun 13, 2016
Makefile Use demo-mode for development Jun 27, 2014
README.rst Updated README now that the migrations are included Jun 13, 2016
requirements.txt Only a single save in Oct 4, 2014
tox.ini More djangos to test Jun 13, 2016



Generalized app for two-step verification.


  1. Install the library, for instance with pip:

    pip install django-verification
  2. Add the library to your INSTALLED_APPS of an exiting project:

    INSTALLED_APPS += ['verification']
  3. Add the tables to the existing project:

    python migrate verification


To 0.4.1 (needs Django 1.7+):

python migrate --fake verification 0001_initial


Copy the entire django-verification directory somewhere, set up and enter a virtualenv, then provided you are on some Un*x:

make demo

This'll automatically make a user "admin" with the password "demo".

The demo should now be running on

Running make demo again will erase the database from the previous run.


To run the tests, first install the testing-requirements:

pip install -r requirements/test.txt

then run the tests with:

make test APP=verification


Create a KeyGroup. KeyGroups hold the config for your Keys, so you might want to make fixtures of them.

from verification.models import KeyGroup

keygroup = KeyGroup(
    name='activate_account', # Unique
    generator='sha1',        # See verification.generators

Create a Key on some event, for instance when a user clicks a button:

from verification.models import Key


Set Key.send_func to some callable:

from django.core.mail import send_mail

# In this minimal example, the contents of the email is created earlier
def email_key(recipient, content):
    subject = "Activate account on FooBlog"
    recipient = ''.join(recipient.strip().split())
    # Use any kind of messaging-system here
    send_mail(subject, content, '', [recipient])

key.send_func = email_key

Choose the claim-view, make the content of the email, send it with key.send_key():

from django.core.urlresolvers import reverse

activate_url = reverse('verification-claim-post-url',
        kwargs={'key': key, 'group':})
content = "Click on %s to activate your account on FooBlog!" % activate_url
recipient = ''

key.send_key(recipient, content)

Hook the key_claimed-signal in order to do something after the key is claimed:

from django.dispatch import receiver

from verification.signals import key_claimed

def user_created_key_claimed(sender, **kwargs):
    claimant = kwargs['claimant']
    claimant.is_active = True