djangosnippets.org: Latest snippets tagged with 'auth.contrib'https://djangosnippets.org/tags/authcontrib/2009-06-04T15:53:57.354206-05:00LoginAsForm - Login as any User without a password
2009-06-04T15:53:57.354206-05:00johnboxallhttps://djangosnippets.org/snippets/1552/<p>Sometimes the only way to reproduce a bug on a production site is to login as the User who encountered it. This form allows you to login as any user on the site.</p>
<p><strong>Usage</strong></p>
<pre><code>@staff_member_required
def login_as(request, template="login_as.html"):
data = request.POST or None
form = LoginAsForm(data, request=request)
if form.is_valid()
form.save() …</code></pre>
Freely redistributable