CakePHP 2 を使用していますが、ある顧客がアプリケーションにログインしようとすると、奇妙な問題が発生します。ストーリーは次のとおりです。彼女はDBに設定されたアカウントを持っています。私は彼女のアカウント情報を使用してログインできますが、彼女はできません。エラーは表示されません (間違った電子メール/パスワードなど)。彼女がログインを押すと、再びログイン フォームにアクセスします。
だから、私の AppController.php で
public $components = array(
'Acl',
'Auth' => array(
'authorize' => array('Actions' => array('actionPath' => 'controllers')),
'authenticate' => array('Form' => array('fields' => array('username' => 'email')))
),
'RequestHandler',
'Session'
);
public function beforeFilter() {
$group = $this->Auth->user('Group.name');
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
if ($group == 'customer') {
$this->layout = "customer";
$this->Auth->loginRedirect = array('controller' => 'overviews', 'action' => 'index');
}
else {
$this->layout = "default";
$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'index');
}
}
私のConfig/core.phpで
Configure::write('Session', array(
'defaults' => 'cake',
'checkAgent' => false,
'timeout' => '120',
));
Configure::write('Security.level', 'low');
問題がどこにあるのか本当にわかりません...自分のコンピューターで問題を再現できません。
編集: UsersController.php login()
public function login() {
$this->layout = 'login';
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect(array('controller' => 'pages', 'action' => 'index'));
} else {
$this->Session->setFlash('Vos identifiants sont incorrectes.');
}
}
}