응용 프로그램의 모든 컨트롤러에서 인증 구성 요소를 사용할 수 있습니다. 당신이 그것을 원할 경우에만 관리 섹션에 다음 응용 프로그램 AppController에서 beforeFilter funciton에 조건을 추가 할 수 있습니다 Auth 초기화에 같은.
// for component initialization.
public $components = array(
'Auth' => array(
'authenticate' => array(
'userModel' => 'Customer', // you can also specify the differnt model instead of user
'Form' => array(
'fields' => array('username' => 'email')
)
)
)
}
당신은 다음과 같은 올바른 형식으로 리디렉션 동작을 지정했는지 확인 후 케이크 인 2.3.x를 사용하거나하는 경우는
function beforeFilter(){
// only works with admin routing.
if(isset($this->request->params['prefix']) && ($this->request->params['prefix'] == 'admin')){
$this->Auth->loginRedirect = array('admin' => true, 'controller' => 'pages', 'action' => 'index');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login', 'admin' => true);
$this->Auth->loginAction = array('admin' => true, 'controller' => 'customers', 'action' => 'login');
}
}
처럼 관리 라우팅에 바인딩 할 수 있습니다.
return $this->redirect('action_name'); // you can also specify the array of parameters.
비슷한 질문 : http://stackoverflow.com/questions/16820195/cakephp-admin-section-routing-and-redirecting – Dezigo