Commits

Tino de Bruijn committed bc873cf

Added urls.py for using email-login outside of the admin

Comments (0)

Files changed (4)

         (r'^admin/', include(site.urls)),
 
    to include the admin in your root ``urls.py``.
+   
+#. To use login outside of the admin, add::
+   
+        (r'^account/', include('django.contrib.auth.urls')),
+   
+   to your ``urls.py``
 
 .. note:: 
     Your admin account needs to have an email address, otherwise you won't be

email_login/auth_backend.py

 class EmailBackend(ModelBackend):
     
     def authenticate(self, email=None, password=None):
+        import pdb; pdb.set_trace()
         try:
             user = User.objects.get(email=email)
             if user.check_password(password):

email_login/urls.py

+# We need to override login view, the rest is ok.
+from django.conf.urls.defaults import *
+from django.contrib.auth.urls import urlpatterns
+
+urlpatterns += patterns('',
+    (r'^login/$', 'django.contrib.auth.views.login', 
+        { 'template_name' : 'email_login/login.html',
+          'authentication_form' : 'email_login.forms.EmailAuthenticationForm'}),
+)
 
 setup(
     name='email_login',
-    version='0.1',
+    version='0.2',
     description='A Django application that enables you to have your users use their email address instead of their username',
     author='Tino de Bruijn',
     author_email='tinodb@gmail.com',