Login as Any Site user

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

More like this

  1. LoginAsForm - Login as any User without a password by johnboxall 4 years, 10 months ago
  2. Specify a manager for the Admin by kylefox 6 years, 2 months ago
  3. All Imports Checker by madhav.bnk 4 years, 4 months ago
  4. testdata tag for templates by showell 4 years, 11 months ago
  5. Simple login script from a nub by alandelevie 5 years, 4 months ago

Comments

KomarovPetr26 (on December 2, 2011):

ВИП-сваха для брака с богачом

#

(Forgotten your password?)