Search code examples
djangodjango-registration

django unsuccessful login fail page


I am using django-registration and would like to have a different page for failed logins. The initial login screen is loaded via jQuery, so doesn't need to extend the base page:

{% extends 'base.htm' %}

but the "fail" page does need to extend it. I cannot "if" an extends tag because it needs to be the first tag on the page.

So! I thought to load a different login-fail page, but I haven't the foggiest how to do that - how do I specify a different login-fail page?


Solution

  • sigh.

    So the login page needs to be changed - i suppose i could extend and override it in a child class - maybe i will so i don't lose all my logic!

    Yeah, i cut and paste it into my own views.py file

    Ok, so all i done was add an "else" after the form.is_valid check that sets a variable (failed) to true.

    And then, at the end of the method, when i render_to_response, i run a check to see if failed is True - and if so, just render to a different login page (failedLogin.html) ~ where this one does extend base.htm.

    yay!