<div class="gmail_quote">On Wed, Sep 30, 2009 at 8:09 AM, Bill Moseley <span dir="ltr">&lt;<a href="mailto:moseley@hank.org">moseley@hank.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Wed, Sep 30, 2009 at 7:30 AM, Derek Wueppelmann <span dir="ltr">&lt;<a href="mailto:dwueppel@gmail.com" target="_blank">dwueppel@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I&#39;m actually doing forwards to my login page right now. So that when a<br>
user logs in they can still see the page they were originally trying to<br>
view. I capture the URL they were attempting to view in the login<br>
process.<br></blockquote></div><div><br>And then redirect back to that original page after login? <br></div><div><br>I pass that data via the cache or session. <br></div><div><br>$c-&gt;cache-&gt;set( $key, { <br>    orig_url =&gt; $url,<br>

    message =&gt; &#39;Auhorization is required&#39;,<br> });<br><br>$c-&gt;res-&gt;redirect( $c-&gt;uri_for( &#39;/login&#39;, { info =&gt; $key } ) );<br><br><br>Catalyst docs show an example using auto.  BTW - shouldn&#39;t the redirect be an absolute-URI?<br>

<br>           sub auto : Private {<br>               my ( $self, $c ) = @_;<br>               if ( !$c-&gt;user_exists ) { # Catalyst::Plugin::Authentication<br>                   $c-&gt;res-&gt;redirect( &#39;/login&#39; ); # require login<br>

                   return 0; # abort request and go immediately to end()<br>               }<br>               return 1; # success; carry on to next action<br>           }<br></div></div></blockquote><div> <br><br>My typical recipe is via parameter, rather than session.  This is more flexible, and allows me to pass URLs to people with more definitive results.<br>
<br>You do, however, have to whitelist the URLs prior to redirection.  The very basic recipe is just something to compare the URI base:<br><br> my $redir = URI-&gt;new( $redir_url );<br> $redir-&gt;base eq $c-&gt;req-&gt;uri-&gt;base;<br>
<br>-J<br><br></div></div>