<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My Own Private Thermopylae &#187; Django</title>
	<atom:link href="http://thermopylae.net/blog/tag/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://thermopylae.net/blog</link>
	<description>Do I know what a rhetorical question is?</description>
	<lastBuildDate>Sat, 14 Mar 2009 18:53:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Login on behalf of a user in Django</title>
		<link>http://thermopylae.net/blog/2009/02/26/login-on-behalf-ofa-user-in-django/</link>
		<comments>http://thermopylae.net/blog/2009/02/26/login-on-behalf-ofa-user-in-django/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 18:57:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://thermopylae.net/blog/?p=107</guid>
		<description><![CDATA[There are several points during the pieces of a Django app&#8217;s lifecycle where you&#8217;d like to log in a user without going through the standard login views. These are situations when the user has authenticated their identity in some other way, for example: User just successfully signed up.  There&#8217;s no reason to ask them to [...]]]></description>
			<content:encoded><![CDATA[<p>There are several points during the pieces of a Django app&#8217;s lifecycle where you&#8217;d like to log in a user without going through the standard login views. These are situations when the user has authenticated their identity in some other way, for example:</p>
<ul>
<li>User just successfully signed up.  There&#8217;s no reason to ask them to re-enter the credentials they just set up.</li>
<li>User just reset their password.</li>
</ul>
<p>The official documentation isn&#8217;t super clear on how to do it, but it turns out its incredibly easy:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">contrib</span>.<span style="color: black;">auth</span> <span style="color: #ff7700;font-weight:bold;">import</span> login
&nbsp;
<span style="color: #dc143c;">user</span>.<span style="color: black;">backend</span> = <span style="color: #483d8b;">'django.contrib.auth.backends.ModelBackend'</span>
login<span style="color: black;">&#40;</span>request, <span style="color: #dc143c;">user</span><span style="color: black;">&#41;</span></pre></div></div>

<p>The backend is used by the auth system later on in the process.</p>
]]></content:encoded>
			<wfw:commentRss>http://thermopylae.net/blog/2009/02/26/login-on-behalf-ofa-user-in-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
