[Catalyst] Re: redirection to the original URI

Thomas Hartman thomashartman1 at googlemail.com
Mon Jan 1 07:09:50 GMT 2007


Do you mean Response::redirect() rather than Response::location()? I
couldn't find anything about the location method in

http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7006/lib/Catalyst/Response.pm

Or is this a newer/older version than what's current on cpan?

2007/1/1, Fayland Lam <fayland at gmail.com>:
> 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: Catalyst at lists.rawmode.org
> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> > Dev site: http://dev.catalyst.perl.org/
> >
>
>
> --
> Fayland Lam // http://www.fayland.org/
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list