I'm trying to sign in with an account that already exists in the system, i checked the admin django page of my project to make sure it was there, but everytime i enter the username and password it always redirects me to the invalid webpage when I know the username and password is the exact same as stored in my django login database that is already provided. The login worked well with my previous html login page so I know it can work properly but with this new html login page it is not working. What may be the problem as to why my authenticate function is always returning none? Thanks
Here is my views.py file : def login(request): c={} c.update(csrf(request)) return render_to_response('templates/login3.html',c) def auth_view(request): username=request.POST.get('username','') password=request.POST.get('password','') user = auth.authenticate(username=username, password=password) if user is not None: auth.login(request,user) return HttpResponseRedirect('/Source.html') else: return HttpResponseRedirect('/accounts/invalid/') This is my html templates with my login form: <html> <link rel="stylesheet" type="text/css" href="static/bootstrap-cosmo.min.css"> <link rel="stylesheet" type="text/css" href="static/bootstrap-cosmo.css"> <form class="form-horizontal" action="/accounts/auth/" method="post"> {% csrf_token %} <fieldset> <legend>LOGIN</legend> <div class="form-group"> <label for="username" class="col-lg-2 control-label">Username</label> <div class="col-lg-10"> <input type="text" class="form-control" id="username" placeholder="username"> </div> </div> <div class="form-group"> <label for="password" class="col-lg-2 control-label">Password</label> <div class="col-lg-10"> <input type="password" class="form-control" id="password" placeholder="Password"> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <button type="reset" class="btn btn-default">Cancel</button> <button type="submit" class="btn btn-primary">Submit</button> </div> </div> </fieldset> </form> </html> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1336f837-cb3f-4803-bb16-eb2fccf95ed8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.