map.connect('/account/login', controller='account', action='login')
map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST)
map.connect('/account/login_finish', controller='account', action='login_finish')
+ map.connect('/account/logout', controller='account', action='logout', **require_POST)
map.connect('/account/register', controller='account', action='register')
map.connect('/account/register_finish', controller='account', action='register_finish', **require_POST)
map.connect('/search', controller='search', action='index')
- map.connect('/{controller}/{action}')
- map.connect('/{controller}/{action}/{id}')
-
return map
# XXX send me where I came from
redirect_to('/')
+ def logout(self):
+ """Log user out."""
+
+ if 'user_id' in session:
+ del session['user_id']
+ session.save()
+
+ # XXX success message
+ # XXX send me where I came from
+ redirect_to('/')
+
def register(self):
"""Logging in with an unrecognized identity URL redirects here."""
<div id="user">
% if c.user:
- <p>Logged in as ${c.user.name}</p>
+ <form action="${url(controller='account', action='logout')}" method="POST">
+ <p>Logged in as ${c.user.name}. ${h.submit(None, 'Log out')}</p>
+ </form>
% else:
<form action="${url(controller='account', action='login_begin')}" method="POST">
<p>