Giter VIP home page Giter VIP logo

django-simple-email-confirmation's Introduction

django-simple-email-confirmation

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 different ways of organizing your Users their email address(es). Each email address can be in a confirmed/unconfirmed state.

  • Users have one email address that is stored on the User
  • 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

Create a new User, confirm their email:

email = '[email protected]'
user = User.objects.create_user(email, email=email)
user.is_confirmed # False

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

user.confirm_email(user.confirmation_key)
user.is_confirmed # True

Add another email to an existing User, confirm it, then set it as their primary.

new_email = '[email protected]'
confirmation_key = user.add_unconfirmed_email(new_email)
new_email in user.unconfirmed_emails # True

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)
new_email in user.confirmed_emails # True

user.set_primary_email(new_email)
user.email # [email protected]

Installation

  1. From pypi using pip:

    pip install django-simple-email-confirmation
  2. Add simple_email_confirmation to your settings.INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'simple_email_confirmation',
        ...
    )
  3. 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

    Note: you don't strictly have to do this final step. Without this, you won't have the nice helper functions and properties on your User objects but the remainder of the app should function fine.

Running the Tests

  1. Install tox.

  2. From the repository root, run

    tox

    It's that simple.

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.

django-simple-email-confirmation's People

Contributors

mfogel avatar jtauber avatar brosner avatar alpden550 avatar jezdez avatar g-as avatar djedi avatar empty avatar imposeren avatar lehins avatar sys13 avatar dstufft avatar jeffbowen avatar matthewryanscott avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.