Thursday, December 30, 2010

Re: User authentication in Django

Okay, that problem is fixed. I just added the /accounts/login to the
url file.

New problem:

my login page is giving me: CSRF verification failed. Request aborted

This is the html from login.html

{% block content %}

{% if form.errors %}
<p class="error">Sorry, that's not a valid username or password</
p>
{% endif %}

<form action="" method="post">
{% csrf_token %}
<label for="username">User name:</label>
<input type="text" name="username" value="" id="username">
<label for="password">Password:</label>
<input type="password" name="password" value="" id="password">

<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next|escape }}" />
</form>

{% endblock %}

Any ideas?

Cheers,
Aaron

On Dec 30, 4:33 pm, aaron <aaron.jerl...@gmail.com> wrote:
> Hi guys,
>
> I'm attempting to follow the very simple setup for user authentication
> in Django as detailed in the documentation here:
>
> http://docs.djangoproject.com/en/dev/topics/auth/
>
> I've got a database synced, the apps installed as detailed, but when I
> attempt to access a password protected url it gives me the following
> 404 message:
>
> Using the URLconf defined in logintest.urls, Django tried these URL
> patterns, in this order:
> ^logintest/
> ^admin/doc/
> ^admin/
> ^secret/
> The current URL, accounts/login/, didn't match any of these.
>
> Secret is the app that simply renders a page that says 'secret'. It
> works fine when the @login decorator is commented out.
>
> Any ideas?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment