, 나는 domain.com을 가지고 있지만 나는 (URL을 domain.com/logout 입니다) 로그 아웃 할 때, 그것은 domain.com/app/login 로 리디렉션됩니다 리디렉션합니다. domain.com/app/login으로 리디렉션하지 않고 대신 domain.com/logout으로 리디렉션하고 싶습니다. 이들은 어떤 도움이 좋을 것CakePHP의 - 인증 로그 아웃은 cakephp2.0에서
class UsersController extends AppController {
public $components = array(
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
'authorize' => array('Controller') // Added this line
)
);
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('add', 'logout', 'login');
$this->Auth->deny('view');
}
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect('http://domain.com/thankyou');
} else {
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
}
내 UsersController & 내 AppController가
class AppController extends Controller {
public $helpers = array ('Html', 'Form', 'Js' => array('Jquery'), 'Session');
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
'authorize' => array('Controller') // Added this line
)
);
}
Userscontroller에 내가 가지고있는 코드이다. 감사.