[Catalyst] Re: Calling Controller Methods from inside begin or
auto.
Bill Moseley
moseley at hank.org
Wed Sep 30 15:09:57 GMT 2009
On Wed, Sep 30, 2009 at 7:30 AM, Derek Wueppelmann <dwueppel at gmail.com>wrot=
e:
> 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 =3D> $url,
message =3D> 'Auhorization is required',
});
$c->res->redirect( $c->uri_for( '/login', { info =3D> $key } ) );
Catalyst docs show an example using auto. BTW - shouldn't the redirect be
an absolute-URI?
sub auto : Private {
my ( $self, $c ) =3D @_;
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 =3D scheme ":" hier-part [ "?" query ]
And 2616:
Location =3D "Location" ":" absoluteURI
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090930/ae36f=
72b/attachment.htm
More information about the Catalyst
mailing list