Django - Login with Email
<p>I want django to authenticate users via email, not via usernames. One way can be providing email value as username value, but I dont want that. Reason being, I've a url <code>/profile/&lt;username&gt;/</code>, hence I cannot have a url <code>/profile/abcd@gmail.com/</code>.</p>

<p>Another reason being that all emails are unique, but it happen sometimes that the username is already being taken. Hence I'm auto-creating the username as <code>fullName_ID</code>.</p>

<p>How can I just change let Django authenticate with email?</p>

<p>This is how I create a user.</p>

<pre><code>username = `abcd28`
user_email = `abcd@gmail.com`
user = User.objects.create_user(username, user_email, user_pass)
</code></pre>

<p>This is how I login.</p>

<pre><code>email = request.POST['email']
password = request.POST['password']
username = User.objects.get(email=email.lower()).username
user = authenticate(username=username, password=password)
login(request, user)
</code></pre>

<p>Is there any other of of login apart from getting the username first?</p>