Permalink
Browse files

Add a logout

  • Loading branch information...
1 parent 99ec027 commit cc5c7c83a2e01fe834e42e559e64b6e91edc02c2 @paulosman committed Jun 20, 2011
Showing with 9 additions and 0 deletions.
  1. +3 −0 templates/base.html
  2. +1 −0 urls.py
  3. +5 −0 views.py
View
3 templates/base.html
@@ -7,6 +7,9 @@
<body>
<h1>YAPS: Yet Another Profile Service</h1>
{% block body %}{% endblock %}
+ {% if user.is_authenticated %}
+ <p><a href="{% url yaps_logout %}">Logout</a></p>
+ {% endif %}
{% block js %}{% endblock %}
</body>
</html>
View
1 urls.py
@@ -9,6 +9,7 @@
url('^login/$', auth_views.login, {
'template_name': 'login.html',
}, name='yaps_login'),
+ url('^logout/$', 'yaps.views.logout', name='yaps_logout'),
url('^register/$', 'yaps.views.register', name='yaps_register'),
url('^profile/', include('profiles.urls')),
url('^webfinger/', include('webfinger.urls')),
View
5 views.py
@@ -16,6 +16,11 @@ def home(request):
}, context_instance=RequestContext(request))
+def logout(request):
+ auth.logout(request)
+ return HttpResponseRedirect(reverse('yaps_login'))
+
+
def register(request):
form = RegistrationForm()
if request.method == 'POST':

0 comments on commit cc5c7c8

Please sign in to comment.