On Wed, Sep 30, 2009 at 7:30 AM, Derek Wueppelmann <[email protected]>wrote:
> I'm actually doing forwards to my login page right now. So that when a
> user logs in they can still see the page they were originally trying to
> view. I capture the URL they were attempting to view in the login
> process.
>
And then redirect back to that original page after login?
I pass that data via the cache or session.
$c->cache->set( $key, {
orig_url => $url,
message => 'Auhorization is required',
});
$c->res->redirect( $c->uri_for( '/login', { info => $key } ) );
Catalyst docs show an example using auto. BTW - shouldn't the redirect be
an absolute-URI?
sub auto : Private {
my ( $self, $c ) = @_;
if ( !$c->user_exists ) { # Catalyst::Plugin::Authentication
$c->res->redirect( '/login' ); # require login
return 0; # abort request and go immediately to end()
}
return 1; # success; carry on to next action
}
RFC3986 has:
absolute-URI = scheme ":" hier-part [ "?" query ]
And 2616:
Location = "Location" ":" absoluteURI
--
Bill Moseley
[email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/