component that works fine with the login action but not with others
actions because only the login action has the bahavior to render a
element to handle errors like bellow:
if ($loginAction == $url) {
...code
} else {
if (!$this->user()) {
if (!$this->RequestHandler->isAjax()) {
$this->Session->setFlash($this->authError, 'default', array(),
'auth');
$this->Session->write('Auth.redirect', $url);
$controller->redirect($loginAction);
return false;
} elseif (!empty($this->ajaxLogin)) {
$controller->viewPath = 'elements';
echo $controller->render($this->ajaxLogin, $this->RequestHandler-
>ajaxLayout);
$this->_stop();
return false;
} else {
$controller->redirect(null, 403);
}
}
}
The problem is, when i make a request to an action that the function
isAuthorized() returns false, the component redirect the render to a
referer page that its layout is not a ajax layout and the view is the
view's referer, would be a bad thing to replace the actual Auth code
to this bellow?
After this
if ($this->isAuthorized($type)) {
return true;
}
put this
if (!$this->RequestHandler->isAjax()) {
$this->Session->setFlash($this->authError, 'default', array(),
'auth');
$controller->redirect($controller->referer(), null, true);
}else{
$controller->viewPath = 'elements';
echo $controller->render($this->ajaxLogin, $this->RequestHandler-
>ajaxLayout);
$this->_stop();
return false;
}
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment