We now have user authentication via the web interface. @whee.

This commit is contained in:
Greg Taylor 2007-08-02 19:37:16 +00:00
parent be4e0069a6
commit 2e397df4d5
4 changed files with 56 additions and 5 deletions

View file

@ -10,12 +10,16 @@ from django.conf.urls.defaults import *
import settings
urlpatterns = patterns('',
# User Authentication
(r'^accounts/login', 'django.contrib.auth.views.login'),
(r'^accounts/logout', 'django.contrib.auth.views.logout'),
# Admin interface
(r'^admin/', include('django.contrib.admin.urls')),
# Front page
(r'^', include('apps.website.urls')),
# News stuff
(r'^news/', include('apps.news.urls')),

View file

@ -18,7 +18,7 @@
{% block header_ext %}
{% endblock %}
<title>{{game_name}} - {% if flatpage %}{{flatpage.title}}{% else %}{{page_title}}{% endif %}</title>
<title>{{game_name}} - {% if flatpage %}{{flatpage.title}}{% else %}{% block titleblock %}{{page_title}}{% endblock %}{% endif %}</title>
</head>
<body>
@ -45,9 +45,15 @@
<div class="headerLinks">
<span class="doNotDisplay">Tools:</span>
<a href="/tbi">Log In &laquo;</a>
<span class="doNotDisplay">|</span>
<a href="/tbi">Register &laquo;</a>
{% if user.is_authenticated %}
<a href="/accounts/logout/">Log Out &laquo;</a>
<span class="doNotDisplay">|</span>
Logged in as {{user.username}} &laquo;
{% else %}
<a href="/accounts/login/">Log In &laquo;</a>
<span class="doNotDisplay">|</span>
<a href="/tbi">Register &laquo;</a>
{% endif %}
</div>
</div>

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block titleblock %}
Logged Out
{% endblock %}
{% block content %}
<h1 id="alt-layout">Logged Out</h1>
<p>You have been logged out.</p>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block titleblock %}
Login
{% endblock %}
{% block content %}
<h1 id="alt-layout">Login</h1>
{% if user.is_authenticated %}
<p>You are already logged in!</p>
{% else %}
{% if form.has_errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<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>
<input type="submit" value="Login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endif %}
{% endblock %}