Skip to main content

Simple email confirmation for django.

Project description

https://api.travis-ci.org/mfogel/django-simple-email-confirmation.png?branch=develop https://coveralls.io/repos/mfogel/django-simple-email-confirmation/badge.png?branch=develop https://pypip.in/v/django-simple-email-confirmation/badge.png https://pypip.in/d/django-simple-email-confirmation/badge.png

A Django app providing simple email confirmation.

This app can be used to support three types of User models:

  • Users have one email address that is stored on the User model
  • Users have one primary email address stored on the User model, and have N secondary emails stored in EmailAddress objects
  • Users have N email addresses stored in EmailAddress objects.

Examples

Add the provided mixin to your django 1.5+ custom user model:

from django.contrib.auth.models import AbstractUser
from simple_email_confirmation import SimpleEmailConfirmationUserMixin

class User(SimpleEmailConfirmationUserMixin, AbstractUser):
    pass

then, when creating a new User you probably want to do something like:

user = User.objects.create_user('original@here.com')
address = user.add_unconfirmed_email(user.email)

confirmation_key = address.key
user.is_confirmed # False

send_email(user.email, 'Use %s to confirm your email' % confirmation_key)
# User gets email, passes the confirmation_key back to your server

user.confirm_email(confirmation_key)
user.is_confirmed # True

when changing a User’s email, the flow might go:

new_email = 'newaddr@nowhere.com'
address = user.add_unconfirmed_email(new_email)

confirmation_key = address.key
user.is_email_confirmed(new_email) # False

send_email(new_email, 'Use %s to confirm your new email' % confirmation_key)
# User gets email, passes the confirmation_key back to your server

user.confirm_email(confirmation_key)
user.is_email_confirmed(new_email) # True

user.set_primary_email(new_email)
user.email # newaddr@nowhere.com

Installation

From pypi using pip:

pip install django-simple-email-confirmation

Running the Tests

Using Doug Hellman’s virtualenvwrapper:

mktmpenv
pip install django-simple-email-confirmation
export DJANGO_SETTINGS_MODULE=simple_email_confirmation.test_project.settings
django-admin.py test simple_email_confirmation

Found a Bug?

To file a bug or submit a patch, please head over to django-simple-email-confirmation on github.

Credits

Originally adapted from Pinax’s django-email-confirmation, which was originally adapted from James Tauber’s django-email-confirmation.

Project details


Release history Release notifications

History Node

0.23

History Node

0.22

History Node

0.21

History Node

0.12

History Node

0.11

History Node

0.10.2

History Node

0.10.1

History Node

0.10

This version
History Node

0.9.1

History Node

0.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-simple-email-confirmation-0.9.1.tar.gz (6.9 kB) Copy SHA256 hash SHA256 Source None Aug 5, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page