I have an admin webapp.one have to login before perfoming any action.Now the /default/index/index has the login form which is an ExtJs component.basically the login process is an ajax one.i've created a plugin to disable the rendering and layout and to check whether user is logged in or not(no full acl yet).
here is the code:
public function preDispatch(Zend_Controller_Request_Abstract $request) {
parent::preDispatch($request);
if($request->isXmlHttpRequest()){
$ViewHelper = Zend_Controller_Action_HelperBroker::getStaticHelper("ViewRenderer");
$ViewHelper->setNoRender(true);
Zend_Layout::getMvcInstance()->disableLayout();
}
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if(!Zend_Auth::getInstance()->hasIdentity()){
$url = "/".$module."/".$controller."/".$action;
$session = new Zend_Session_Namespace("myapp.auth");
$session->requestURL = $url;
$request->setModuleName("default");
$request->setControllerName("index");
$request->setActionName("index");
$request->setDispatched();
}
}
this seems to work but then the address bar still have the original request url.
for example i've typed "myapp/admin/cpanel"
in the url bar and it opens the login page on the browser while the address bar still has "myapp/admin/cpanel"
.at the moment the login fails because the output has some html rendering i believe is from the login page(which has been working fine when hit directly).
Has anyone has experienced this before or it's just me doing something wrong.I'will be glad if you can share your experience with this.
thanks for reading this.