So, I am writing my first Django app that requires some form of
authentication, and I have run into a bit of a snag:

I authenticate the user via the 'django.contrib.auth.views.login' view
using a login template like this:

<code>
{% block main_section %}
<div class="content">
<center>
{% if form.has_errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<h1>LoanCRM</h1>
<form method="post" action=".">
<table>
<tr><td><label for="id_username">Username:</label></
td><td>{{ form.username }}</td></tr>
<tr><td><label for="id_password">Password:</label></
td><td>{{ form.password }}</td></tr>
</table>
<br>
<input type="submit" value="login" />
<input type="hidden" name="next" value="/home" />
</form>
</center>
</div>
{% endblock %}
</code>

As you can see, this redirects the user to the URL "/home".

"Home" is rendered using a template like this:

<code>

<div class="content">
{% block contentbody %}
{% if is_logged_in %}Thanks for logging in!{% else %}Please log in.{%
endif %}
{% endblock %}
</div>

</code>

The login process seems to work just fine. If the password is
incorrect, the login page will warn them. If the password is correct,
the user proceeds to the "/home" URL.

The problem is that once they are at the "/home" URL, the template
does not show that the user is logged in. The "if is_logged_in" test
fails.

What could I be doing wrong?


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to