diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 7769a73e..06babef2 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -43,7 +43,7 @@ sub login :Local { my $username = $c->request->params->{username} || ""; my $password = $c->request->params->{password} || ""; - if ($username eq "" && $password eq "" && ! defined $c->flash->{referer}) { + if ($username eq "" && $password eq "" && !defined $c->flash->{referer}) { my $baseurl = $c->uri_for('/'); my $refurl = $c->request->referer; $c->flash->{referer} = $refurl if $refurl =~ m/^($baseurl)/; @@ -58,6 +58,8 @@ sub login :Local { $c->stash->{errorMsg} = "Bad username or password."; } + $c->keep_flash("referer"); + $c->stash->{template} = 'login.tt'; } diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index e5dd05b9..6e90071e 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -97,7 +97,6 @@ sub notFound { sub requireLogin { my ($c) = @_; - $c->flash->{afterLogin} = $c->request->uri; $c->response->redirect($c->uri_for('/login')); $c->detach; # doesn't return } diff --git a/src/root/login.tt b/src/root/login.tt index 74a373ef..5ac6eec3 100644 --- a/src/root/login.tt +++ b/src/root/login.tt @@ -10,24 +10,25 @@ You can logout here.
-
-
- -
- +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
+
+ +
+