1. Chris Moffitt
  2. satchmo


Bruce Kroeze  committed 949a8a0

Updating email auth to use the ModelBackend from Django

  • Participants
  • Parent commits 4992e78
  • Branches default

Comments (0)

Files changed (1)

File satchmo/accounts/email-auth.py

View file
  • Ignore whitespace
 Thanks to Vasily Sulatskov for sending this to the list.
+from django.contrib.auth.backends import ModelBackend
 from django.contrib.auth.models import User
 from django.core.validators import email_re
-class BasicBackend:
-    def get_user(self, user_id):
-        try:
-            return User.objects.get(pk=user_id)
-        except User.DoesNotExist:
-            return None
-class EmailBackend(BasicBackend):
+class EmailBackend(ModelBackend):
     def authenticate(self, username=None, password=None):
         #If username is an email address, then try to pull it up
         if email_re.search(username):