Skip to content Skip to sidebar Skip to footer

Django Login Form- Logs Into The Dashboard 2nd Time

I've a login form. Whenever I sign into it for the first time, it asks me the username and password again, without showing me inavlid username and password. But when I login again

Solution 1:

As you can see in these logs:

1st :

[28/Apr/2014 06:49:22] "POST /dashboard/ HTTP/1.1"3020 
[28/Apr/2014 06:49:22] "GET /login/?next=/dashboard/ HTTP/1.1"2001536

2nd :

[28/Apr/2014 06:50:27] "POST /login/dashboard/ HTTP/1.1"3020 
[28/Apr/2014 06:50:27] "GET /dashboard/ HTTP/1.1"20011292

The 1st time you are doing a POST request to /dashboard url, which must be login_required. Hence, you get a 302 redirect to /login/?next=/dashboard/

The 2nd time youPOST correctly on /login. Hence you get logged in and redirected to /dashboard

Now you will have to debug and see why the first POST request is being made to /dashboard rather than /login ?

Post a Comment for "Django Login Form- Logs Into The Dashboard 2nd Time"