Octavian Rasnita wrote:
Hi,
If the user wants to access a restricted zone and it is redirected to
the login page, which is the recommended way of redirecting him back to
the original URL?
I know that I could create a hidden field in the login form and put the
request URL in that field, and after the login, make a redirect to that
URL, but I just want to know if there is a more easier way.
well I would put such code in the sub end : Private {
if ($c->res->location) {
# for login using!
if ($c->res->location =~ /^\/login/) {
my $location = '/login?referer=/' . $c->req->path;
$location .= '?' . uri_escape($c->req->uri->query) if
($c->req->uri->query);
$c->res->location($location);
}
return 1;
}
that would be much easier.
Thanks.
Octavian
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
--
Fayland Lam // http://www.fayland.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/