]> git.rustad.me Git - duplo/commitdiff
Fix admin rights
authorBjørn Rustad <rustadbjornen@gmail.com>
Sat, 17 Aug 2013 13:59:34 +0000 (15:59 +0200)
committerBjørn Rustad <rustadbjornen@gmail.com>
Sat, 17 Aug 2013 13:59:34 +0000 (15:59 +0200)
lib/Duplo.pm
templates/errors/403.html.ep [new file with mode: 0644]

index a10f1dc38b1e9fd197ff6d1e133f1c8a17865e07..9979506aa07cfd96cb73be0c09fa3dd2d5c92e07 100644 (file)
@@ -97,9 +97,11 @@ sub startup {
                my $self = shift;
 
                return 1 if (defined $self->session('user')
-                               and is_admin($self, $self->session('user')));
+                               && is_admin($self, $self->session('user')));
 
-               return $self->redirect_to('/');
+               $self->render(template => 'errors/403', status => 403);
+
+               return undef;
        });
 
        my $in = $r->bridge->to(cb => sub {
@@ -107,7 +109,8 @@ sub startup {
 
                return 1 if defined $self->session('user');
 
-               return $self->redirect_to('login_form');
+               $self->redirect_to('login_form');
+               return undef;
        });
 
        $in->route('/riders')
diff --git a/templates/errors/403.html.ep b/templates/errors/403.html.ep
new file mode 100644 (file)
index 0000000..3c44315
--- /dev/null
@@ -0,0 +1 @@
+<html><body><img src="http://31.media.tumblr.com/tumblr_mcdmbsJ3xN1rcsruoo1_400.gif" /></body></html>