Created
November 25, 2009 03:24
-
-
Save nandak522/242439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login_using_email(request, email): | |
'''DONT EVER USE this method for normal purposes. This is only there, for debugging specific problems related to users''' | |
from django.contrib.auth import get_backends | |
backend = get_backends()[0] | |
from django.contrib.auth.models import User | |
user = User.objects.get(email=email) | |
user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__) | |
from django.contrib.auth import login as django_login | |
django_login(request, user) | |
#set_any_extra_session_variables(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment