Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

link to management page, more logging in production

  • Loading branch information...
commit 9cf218f33c2a5d10225028df7f80ea06f17d8444 1 parent e78434e
@szabgab authored
View
3  environments/production.yml
@@ -1,7 +1,8 @@
# configuration file for production environment
# only log warning and error messsages
-log: "warning"
+#log: "warning"
+log: "core"
# log message to a file in logs/
logger: "file"
View
6 lib/Dwimmer.pm
@@ -20,11 +20,13 @@ hook before_template => sub {
###### routes
my @error_pages = qw(invalid_login not_verified);
-get '/' => sub {
+sub route_index {
# my $db = _get_db();
# my $admin = $db->resultset('User')->find( {name => 'admin'});
template 'index';
};
+get '/' => \&route_index;
+get '/index' => \&route_index; # temp measure to allow the current configuration to work in CGI mode
post '/login' => sub {
my $username = params->{username};
@@ -41,7 +43,7 @@ post '/login' => sub {
return redirect '/not_verified' if not $user->verified;
- session user => $username;
+ session username => $username;
session logged_in => 1;
View
3  views/index.tt
@@ -1,6 +1,3 @@
-Hi
-<a href="/page">add a new entry</a>
-
<% FOR e IN data.keys.sort %>
<hr />
<h2><% data.$e.title %></h2>
View
5 views/layouts/main.tt
@@ -14,9 +14,10 @@
</head>
<body>
-<a href="/">home</a> |
+<a href="/">home</a>
<% IF logged_in %>
-<% username %> <a href="/logout">logout</a>
+| logged in as <a href="/manage"><% username %></a> <a href="/logout">logout</a>
+| <a href="/manage/edit_this_page">edit this page</a>
<% ELSE %>
<form method="POST" action="/login">
name: <input name="username"> password: <input type="password" name="password"> <input type="submit" value="Login">
View
6 views/manage.tt
@@ -0,0 +1,6 @@
+<ul>
+<li><a href="/manage/page">add a new page</a></li>
+<li><a href="/manage/pages">list pages</a></li>
+</ul>
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.