1

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.');
        }
    }
}
4

1 に答える 1

0

ログイン アクションから手動リダイレクトを削除してみてください。

$this->redirect(array('controller' => 'pages', 'action' => 'index'));

loginRedirectAuth コンポーネントのプロパティはすでに設定されています。

そうでなければ、これは奇妙です。すべてのブラウザ キャッシュ (Cookie + キャッシュ) をクリアするようユーザーに依頼します。またtmp、サーバー上のすべてのディレクトリが WebServer ユーザーによって書き込み可能かどうかを確認します。これには、システムtmpディレクトリが含まれます。

この投稿にコメントして、引き続きこの問題の解決に努めてください。クライアント側の問題を指摘していますが、あなたにはわかりません。:D

于 2012-12-07T09:11:37.643 に答える