Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # settings.py
- ...
- AUTHENTICATION_BACKENDS = ('project.auth_backend.CustomBackend',)
- ...
- # auth_backend.py
- from django.contrib.auth.backends import ModelBackend
- from django.contrib.auth.models import User
- class CustomBackend(ModelBackend):
- def authenticate(self, username=None, password=None):
- try:
- user = User.objects.get(username=username)
- if user.check_password(password):
- [b]# do some voodoo[/b]
- return user
- except User.DoesNotExist:
- return None
Add Comment
Please, Sign In to add comment