mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-10 00:42:06 +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.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('',
|
urlpatterns = patterns('',
|
||||||
@ -8,7 +8,10 @@ urlpatterns = patterns('',
|
|||||||
# News & Events
|
# News & Events
|
||||||
(r'^news/(.*)/$', 'news.views.form'),
|
(r'^news/(.*)/$', 'news.views.form'),
|
||||||
(r'^events/(.*)/$', 'events.views.form'),
|
(r'^events/(.*)/$', 'events.views.form'),
|
||||||
|
|
||||||
|
# Log in
|
||||||
|
(r'^login/$', login, {'template_name':'account/login.html'}),
|
||||||
|
|
||||||
# Log out
|
# Log out
|
||||||
(r'^logout/$', logout_then_login, {'login_url': '/' }),
|
(r'^logout/$', logout_then_login, {'login_url': '/' }),
|
||||||
)
|
)
|
||||||
|
@ -17,3 +17,4 @@ def home(request):
|
|||||||
'events': myevents,
|
'events': myevents,
|
||||||
}, NavContext(request, 'account'))
|
}, NavContext(request, 'account'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,6 +70,10 @@ TEMPLATE_DIRS = (
|
|||||||
'../templates/',
|
'../templates/',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LOGIN_URL='/account/login/'
|
||||||
|
LOGIN_REDIRECT_URL='/account/'
|
||||||
|
LOGOUT_URL='/account/logout/'
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'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