I want to forward unauthenticated request to ZfcUser login action, then redirect to original request after successful login.
I have this code inside my controller action;
// Check we are logged in.
if (!$this->zfcUserAuthentication()->hasIdentity()) {
// Set the 'redirect' parameter
$redirect = $this->getRequest()->getRequestUri();
$this->getRequest()->getQuery()->set('redirect', $redirect);
// Forward request to zfcUser's login action.
return $this->forward()->dispatch('zfcuser', array(
'action' => 'login'
));
}
I have un-commented this line in the ZfcUser config;
'use_redirect_parameter_if_present' => true,
It does forward to the ZfcUser login action preserving original url, but it does not redirect back to original requested page after login.
Any ideas on what could be wrong?