Hi there,
I have the following code:
class ControllerBase extends \Phalcon\Mvc\Controller
{
/**
* Kicks in before a route is executed
*
* @param $dispatcher
* @return bool
*/
public function beforeExecuteRoute($dispatcher)
{
if (!$this->session->has('user')) {
if ($dispatcher->getControllerName() == 'login' && $dispatcher->getActionName() == 'new'
|| $dispatcher->getActionName() == 'create') {
return;
}
$this->dispatcher->forward(array(
'controller' => 'login',
'action' => 'new'
));
return false;
}
}
}
When the above code is triggered, I would expect the URL in the browser to say something like https://10.10.22.35/login/new but instead, it says https://10.10.22.35/host_ui/index
Obviously, based on the above beforeExecuteRoute code, when the initial page is loaded (https://10.10.22.35/host_ui/index), there isn't a session item called 'user' and therefore it correctly forwards to login/new. However, I expect the URL in the browser to change? Am I misunderstanding something here? Is my beforeExecuteRoute wrong?
Any advice much appreciated.