mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-06 09:57:57 +00:00
Actually support logging in without using the admin interface
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from django.conf.urls.defaults import *
|
||||
from django.contrib.auth.views import logout_then_login
|
||||
from django.contrib.auth.views import logout_then_login, login
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
@ -9,6 +9,9 @@ urlpatterns = patterns('',
|
||||
(r'^news/(.*)/$', 'news.views.form'),
|
||||
(r'^events/(.*)/$', 'events.views.form'),
|
||||
|
||||
# Log in
|
||||
(r'^login/$', login, {'template_name':'account/login.html'}),
|
||||
|
||||
# Log out
|
||||
(r'^logout/$', logout_then_login, {'login_url': '/' }),
|
||||
)
|
||||
|
@ -17,3 +17,4 @@ def home(request):
|
||||
'events': myevents,
|
||||
}, NavContext(request, 'account'))
|
||||
|
||||
|
||||
|
@ -70,6 +70,10 @@ TEMPLATE_DIRS = (
|
||||
'../templates/',
|
||||
)
|
||||
|
||||
LOGIN_URL='/account/login/'
|
||||
LOGIN_REDIRECT_URL='/account/'
|
||||
LOGOUT_URL='/account/logout/'
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
27
templates/account/login.html
Normal file
27
templates/account/login.html
Normal file
@ -0,0 +1,27 @@
|
||||
{%extends "base/page.html"%}
|
||||
{%block contents%}
|
||||
<h1>Log in</h1>
|
||||
<p>
|
||||
Please log in to your community account.
|
||||
</p>
|
||||
|
||||
<form action="." method="post" id="login-form">
|
||||
<div class="form-row">
|
||||
<label for="id_username">Username:</label> <input type="text" name="username" id="id_username" />
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="id_password">Password:</label> <input type="password" name="password" id="id_password" />
|
||||
<input type="hidden" name="this_is_the_login_form" value="1" />
|
||||
</div>
|
||||
<div class="submit-row">
|
||||
<label> </label><input type="submit" value="Log in" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.getElementById('id_username').focus()
|
||||
</script>
|
||||
</div>
|
||||
|
||||
{%endblock%}
|
||||
|
Reference in New Issue
Block a user