へのAuth
アクセスとユーザーコントローラーのアクションを許可したいのですが、使用するかどうかは問題ではありません。メッセージが表示されますが、正常に動作します。login()
logout()
add()
$this->Auth->allow('logout');
You are not authorized to access that location.
login()
add()
これは私の AppContoller.php です:
class AppController extends Controller {
public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'userModel' => 'User',
'fields' => array(
'username' => 'email', 'password' => 'password')
)
),
'loginRedirect' => array('controller' => 'users', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'landing')
), 'Session'
);
public function beforeFilter() {
$this->Auth->allow('add', 'login');
}
}
これは、UsersController.php の関連部分です。
public $helpers = array('Html', 'Form', 'Session');
public $components = array('Session');
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('logout');
}
public function logout() {
$this->set('title_for_layout', 'Logout');
$this->redirect($this->Auth->logout());
}
誰かがここで問題を見ていますか? 私はあなたの助けに感謝します。