Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

user logout (controller, and option in template)

  • Loading branch information...
commit 9c3cee4d47f00b547ef341debf89d8f08b573264 1 parent 7035cf7
@garu authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 tweetylicious.pl
View
12 tweetylicious.pl
@@ -110,6 +110,14 @@ package main;
} => 'login';
+# user logout is just a matter of expiring the session
+get '/logout' => sub {
+ my $self = shift;
+ $self->session( expires => 1);
+ $self->redirect_to('/');
+};
+
+
# let's rock and roll!
shagadelic;
@@ -133,7 +141,11 @@ package main;
<body>
<div id="header"><a href="/"><div id="logo">Tweetylicious!</div></a>
<div class="options">
+% if (session 'name') {
+ <a href="/<%= session 'name' %>">Home</a><a href="/logout">Sign-Out</a>
+% } else {
<a href="/login">Sign-In</a><a href="/join">Join us!</a>
+% }
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.