[Catalyst] Clearing $c->req->params in CatalystX::SimpleLogin ...

Kiffin Gish kiffin.gish at planet.nl
Fri Feb 19 10:23:23 GMT 2010


I've been playing around with the ideas used in CatalystX::SimpleLogin,
and it's been a good learning experience for me!

However, I discovered a slight problem with the redirect in which the
current uri is saved in a session key like this:

$c->session->{redirect_to_after_login} = $c->uri_for($c->action,
$c->req->captures, $c->req->args->flatten, $c->req->parameters);

(aside: don't forget to include 'use Moose::Autobox;')

If the request parameters are left in place they'll just be passed on to
the login form, or whatever form that may be.

I'm using HTML::FormHandler, and I get an error that the user/password
fields need to be entered.

The solution is to clear the parameters before passing them on to the
loginpage. In the package CX::SL::TF::C::Login::WithRedirect:

# Clear the parameter fields.
delete $c->req->params->{$_} for (keys %{$c->req->params});

Curious what others think...


-- 
Kiffin Gish <Kiffin.Gish at planet.nl>
Gouda, The Netherlands





More information about the Catalyst mailing list