title: how do i manually authenticate and log in a user in django?
body: <pre><code>    if request.method=='POST':
          try:        
              email=request.POST['email']
              password = request.POST['password']
              if StudentUser.objects.filter(email=email).exists():
                  user = StudentUser.objects.get(email=email)
                  if user.check_password(password):
                      user = auth.authenticate(email=email)
                      if user is not None:
                          auth.login(request,user)
                          messages.success(request,'Successfully Loggedin')
                          return redirect('/')
                  else:
                      messages.warning(request,'Password does not match')
                      return redirect('login')
              else:
                  messages.error(request,'No Account registered with this mail')
                  return redirect('login')
          except Exception as problem:
              messages.error(request,problem)
              return redirect('login')
      return render(request,'login.html')
  </code></pre>
  <p>This above code i am trying to authenticate the user manually, but it is not working. i want to authenticate a user by manually checking the password.
  How can i do it?</p>
  <p>** when I am passing the password in auth.authenticate function it is showing password does not match error</p>