[Catalyst] Transferring control via root/auto

Thompson robt at matsch.com
Tue Dec 7 15:53:03 GMT 2010


Here is my problem,

If a user logs in for the 1st time I want to force them to change their
password.  I have a specific action in my Users controller to handle
that.  What I'm having a problem with is (redirecting or forwarding or
detaching - i've tried them all) from the root/auto function to my
specific controller function.  I either get an internal server error or
page isn't redirecting properly, depending what i use.  I've put my
logic in the root/auto because regardless of the request changing their
password is mandatory.

Here is my current root/auto using redirect.

sub auto : Private {
           my ($self, $c) = @_;

           if ($c->user_exists()&&  $c->check_any_user_role('User')
&&  $c->user->changePassword  ) {

$c->res->redirect($c->uri_for($c->controller('Users')->action_for('loginedit'), 

[$c->user->id] ));
                  $c->detach();
           }

           return 1;
       }

Any help would be appreciated.
Rob T



More information about the Catalyst mailing list