[Catalyst] Re: redirection to the original URI
    Fayland Lam 
    fayland at gmail.com
       
    Mon Jan  1 05:46:09 GMT 2007
    
    
  
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/
    
    
More information about the Catalyst
mailing list