title: Django cannot login using login()
body: <p>I'm trying to create a login page using <code>login()</code> and <code>authenticate()</code>, but when I submit the username and password, the user doesn't get authenticated (<code>is_authenticated = False</code>), same as if I submit wrong password and/or username.</p>
  
  <p>views.py : </p>
  
  <pre><code>from django.http import HttpResponseRedirect
  from django.shortcuts import render_to_response
  from django.template import RequestContext
  from whitesnake.forms import RegistrationForm, LoginForm
  from django.contrib.auth.models import User
  from whitesnake.models import Whitesnake
  from django.contrib.auth import authenticate, login, logout
  
  def WhitesnakeLogin(request):
  if request.user.is_authenticated():
      return render_to_response('index.html', None, context_instance = RequestContext(request))
  if request.method =='POST':
      login_form = LoginForm(request.POST)
      if login_form.is_valid():
          username = login_form.cleaned_data['username']
          password = login_form.cleaned_data['password']
          whitesnake = authenticate(username = username, password = password)
          if whitesnake is not None:
              login(request, whitesnake)
              return HttpResponseRedirect('/admin/')
          else:
              login_form = LoginForm()
              context = {'login_form' : login_form}
              return render_to_response('index.html', context, context_instance = RequestContext(request))
      else:
          login_form = LoginForm()
          context = {'login_form' : login_form}
          return render_to_response('index.html', context, context_instance = RequestContext(request))        
  else:
      login_form = LoginForm()
      context = {'login_form' : login_form}
      return render_to_response('index.html', context, context_instance = RequestContext(request))
  </code></pre>
  
  <p>forms.py : </p>
  
  <pre><code>from django import forms
  from django.forms import ModelForm
  from django.contrib.auth.models import User
  from whitesnake.models import Whitesnake
  
  class LoginForm(forms.Form):
      username = forms.EmailField(label=(u'Username'))
      password = forms.CharField(label=(u'Password'), widget = forms.PasswordInput(render_value = False))
  </code></pre>
  
  <p>i already made a register page and I'm make sure that the username and the password i use are correct and already stored in MySQL. Whitesnake is the name of the user app</p>