title: user authenticate is not working Django
body: <p>user is not getting authenticated when i try to login.</p>
  
  <p>this my register code  </p>
  
  <pre><code>def register(request):
  if request.method == "POST":
      username = request.POST["name"]
      email =  request.POST["email"]
      password = request.POST["password"]
      password2 = request.POST["password2"]
  
      try:
          if password2 != password:
              messages.error(request, "password did'nt match")
          elif User.objects.get(email=email):
              messages.error(request, "user already exists")
      except: 
          if email and username:
              user = User.objects.create_user(username=username, email=email)
              user.set_password(password)
              user.save()
              messages.success(request, "user created")
          else:
              messages.error(request, "Looks like user already exists")
  
  return render(request, 'register.html', {})
  </code></pre>
  
  <p>this if my login code if i am using user.object.get for email and check_password for password it,s working but when i am using authenticate it,s not working . printing authenticate is returning None  </p>
  
  <pre><code>def login(request):
  
      if request.method == "POST":
          email = request.POST["email"]
          password = request.POST["password"]
          print email
          print password
          try:
              user = authenticate(email=email , password=password)
              if user is not None:
                  login(request, user)                    
                  return redirect('dashbord')
              else:
                  messages.error(request, "password yesn't match")
  
          except:
  
              messages.error(request, "login fail plz check ur password or email again")
  
  
      return render(request, 'login.html', {})
  </code></pre>