Package: django_email_auth
email_authis an email based authentication backend forDjango. It allows you to use Django’s built-in authentication mechanisms and User model while authenticating User on email address instead of username.It basically re-uses the original Django auth code, passing it a custom Form to allow for email authentication. Overall application structure is based on the one used byDjango CAS, i.e. a custom authentication backend and a middleware to intercept calls to original login views (especially useful if you use the Django admin).email_authshould be compatible with Django 1.3 and 1.4 versions.email_authis (c) 2009-2012 Jean-Charles Bagneris. See LICENSE for redistribution
information and usual disclaimer.InstallationThe easiest and prefered way is to install from PyPI, either through pip or through
easy_install:$ pip install django_email_auth

$ easy_install -U django_email_authYou can download the sources as well, and install from source:$ python setup.py installThen, reference the middleware and the backend in yoursettings.pyproject’s file. Resulting settings may look like:MIDDLEWARE_CLASSES = (
        'django.middleware.gzip.GZipMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'email_auth.middleware.EmailAuthMiddleware',
        'django.middleware.locale.LocaleMiddleware',
        'django.middleware.common.CommonMiddleware',
)

AUTHENTICATION_BACKENDS = (
        'email_auth.backends.EmailBackend',
)If you want to use the login and logout templates provided instead of custom ones, make sure thatdjango.template.loaders.app_directories.load_template_sourceis in your TEMPLATE_LOADERS setting and addemail_authto your INSTALLED_APPS setting. In addition, these templates are only provided as examples, and require the Django admin app to work, so add it too to your INSTALLED_APPS. For an example:TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.load_template_source',
        'django.template.loaders.app_directories.load_template_source',
)

INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.admin',
        'email_auth',
)If you subclassed the User model instead of using theget_profilemechanism, use the CUSTOM_USER_MODEL setting to indicate the name of your model.email_authwould then return an instance of your custom user model upon successful authentication:CUSTOM_USER_MODEL = 'coaching.Utilisateur'If you want to use a custom login view instead of the one provided
(email_auth.views.login), add a LOGIN_URL_MAP settings, pointing to it (thanks
toWesley Masonfor the patch).Finally, make sure that your project sets the required urls to log your users in and out in your urls mappings:(r'^login/$', 'email_auth.views.login'),
(r'^logout/$', 'email_auth.views.logout'),TemplatesTemplates for login and logout views are supposed to live inregistration/login.htmlandregistration/logged_out.html. Standard ones are provided withemail_auth, put the application in your INSTALLED_APPS and use thedjango.template.loaders.app_directories.load_template_sourcetemplate loader if you want to use those. Otherwise, either provide yours in aregistrationfolder in your root template folder, or pass whatever names your templates have to thetemplate_nameparameter ofloginandlogoutviews.SignalsAs a convenience, signals are raised when a user logs in or out successfully:user_logged_in = Signal(providing_args=['request',])
user_logged_out = Signal(providing_args=['request',])The full login or logoutrequestis passed as an arg to the related signal. In addition, the sender of the logged in signal is the logged in User instance, and the sender of the logged out signal is the User instance which just logged out.Internationalizationemail_authuses Django internationalization mechanism. Make sure you havedjango.middleware.locale.LocaleMiddlewarein your MIDDLEWARE_CLASSES settings to use it. The locale files for the French language are provided with the application. If you create locale files for other languages, feel free to fork the project and send me a pull request for those to be included in the distribution.Similar projectsFull appshttps://code.launchpad.net/django-email-authhttp://pypi.python.org/pypi/django-emailauth/0.1Related snippetshttp://www.djangosnippets.org/snippets/74/http://www.djangosnippets.org/snippets/1590/http://www.micahcarrick.com/django-email-authentication.htmlProposed patch to Djangohttp://code.djangoproject.com/attachment/ticket/8274/authentication_form.diff