$c->session_login($c->req->params->{username},
$c->req->params->{password} );
if ($c->req->{user}) {
- $c->forward('?restricted_area');
+ $c->forward('/restricted_area');
}
}
}
One thing you might need is to forward non-authenticated users to a login
form if they try to access restricted areas. If you want to do this
controller-wide (if you have one controller for your admin section) then it's
-best to add a user check to a '!begin' action:
+best to add a user check to a 'begin' action:
sub begin : Private {
my ($self, $c) = @_;
unless ($c->req->{user}) {
$c->req->action(undef); ## notice this!!
- $c->forward('?login');
+ $c->forward('/user/login');
}
}