code: def authenticate(self, username=None, password=None, **kwargs):
          
          try:
              user = User.objects.get(email=username)
              if user.check_password(password):
                  return user
          except (User.DoesNotExist, User.MultipleObjectsReturned):
              logging.warning('Unsuccessful login attempt using username/email: {0}'.format(username))
  
          return None
docs: "username" being passed is really email address and being compared to as such.