Redirect logged in users to a "you don't have permission" error page in cakephp -
when user logged in , try access particular action he’s not authorized view, user redirected '/' (even can loop behaviour in circumstances). i've searched solutions issue, didn't find anything.
i've written lines in app_controller.php redirect logged in users error page ("you have no permission access...") i'm not sure if i'm messing code.
could advise me? thank you.
in app_controller.php:
var $components = array('auth'); function beforefilter() { $allowedactions = array_map('strtolower', $this->auth->allowedactions); if (!($this->auth->allowedactions == array('*') || in_array($this->action, $allowedactions))) { $_server['http_referer'] = router::url(array('controller' => 'page', 'action' => 'error')); } }
you try use
$this->auth->loginerror = "login error"; $this->auth->autherror = "auth error";
in *app_controller.php* combined echo $session->flash('auth');
in default.ctp view.
another way using auth component's isauthorized
method , redirect depending on outcome.
Comments
Post a Comment