daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Aug 16th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from web.models import User
  2.  
  3. class EmailBackend:
  4.   """
  5.  Authenticate with e-mail.
  6.  """
  7.  
  8.   supports_object_permissions = False
  9.   supports_anonymous_user = False
  10.   supports_inactive_user = False
  11.  
  12.   def authenticate(self, username=None, password=None):
  13.     try: user = User.objects.get(email=username)
  14.     except User.DoesNotExist: return None
  15.     if user.check_password(password): return user
  16.     return None
  17.  
  18.   def get_user(self, user_id):
  19.     try: return User.objects.get(pk=user_id)
  20.     except User.DoesNotExist: return None
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top