From 58ab852f4c227465304479b2893545b7a15d19e7 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Sat, 8 Apr 2017 14:34:22 +0100 Subject: [PATCH] Added extra redirects and basic pages for getting between admin and user side --- lib/Pear/LocalLoop/Controller/Root.pm | 5 ++- templates/layouts/admin.html.ep | 3 +- templates/layouts/user.html.ep | 44 +++++++++++++++++++++++++++ templates/root/home.html.ep | 25 +++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 templates/layouts/user.html.ep create mode 100644 templates/root/home.html.ep diff --git a/lib/Pear/LocalLoop/Controller/Root.pm b/lib/Pear/LocalLoop/Controller/Root.pm index a99bb28..4b5d333 100644 --- a/lib/Pear/LocalLoop/Controller/Root.pm +++ b/lib/Pear/LocalLoop/Controller/Root.pm @@ -3,6 +3,10 @@ use Mojo::Base 'Mojolicious::Controller'; sub index { my $c = shift; + + if ( $c->is_user_authenticated ) { + $c->redirect_to('/home'); + } } sub under { @@ -34,7 +38,6 @@ sub auth_logout { sub home { my $c = shift; - $c->render(text => 'Root Home'); } 1; diff --git a/templates/layouts/admin.html.ep b/templates/layouts/admin.html.ep index 28c3acb..c3cfeea 100644 --- a/templates/layouts/admin.html.ep +++ b/templates/layouts/admin.html.ep @@ -14,7 +14,7 @@ %= content_for 'css'; -