내 웹 사이트에 두 종류의 사용자가 있습니다. 1. 사용자 (프론트 엔드) 2.Admin (백엔드)Cakephp admin과 사용자 로그인이 동시에 올바르게 작동하지 않습니다.
두 가지 유형의 사용자 로그인에 cakephp auth 구성 요소를 사용했습니다. 내 문제는 내가 한 유형의 사용자를 사용하여 로그인 할 때 다른 유형의 사용자 (예 : 프론트 엔드에서 사용자로 로그인)에 로그인 할 때 백업을 새로 고침하면 관리자 유형의 사용자와 함께 logedin 및 동일한 문제가 표시됩니다.
다음은 관리자 및 사용자 용 인증 코드입니다.
이이 나에게
도와주세요public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'userModel' => 'Admin',
'fields' => array(
'username' => 'username',
'password' => 'password'
),
'scope'=>array('Admin.is_active' => 1)
)
)
)
);
public function beforeFilter() {
$this->Auth->loginAction = array('controller' => 'admins', 'action' => 'index');
$this->Auth->logoutRedirect = array('controller' => 'admins', 'action' => 'index');
$this->Auth->loginRedirect = array('controller' => 'admins', 'action' => 'dashboard');
}
내가 사용하고 내 관리자 플러그인 컨트롤러 코드 CakePHP의 2.4.1
입니다
public function beforeFilter() {
if($this->Auth->user()){
$this->set('logged_in', true);
}else{
$this->set('logged_in', false);
}
//Configure AuthComponent
$this->Auth->userScope = array('User.is_active' => '1');
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'signin','plugin' => 'umgmt');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'signin','plugin' => 'umgmt');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index','plugin' => false);
}
응용 프로그램/컨트롤러에 AppController.php 파일입니다
로그인 액션은 어디에 있습니까? –
Moyed Ansari 위의 업데이트 코드가 관리자 로그인 작업 – cakedev