CakePHP登录始终返回false
我需要一个登录/注销系统在我的项目我已经做了一个授权类,但它不会为我工作,因为登录函数总是返回false 这是我的UserController.php 此外,my AppController.php还具有: 最后,我的模型文件是:CakePHP登录始终返回false,php,cakephp,authentication,authorization,Php,Cakephp,Authentication,Authorization,我需要一个登录/注销系统在我的项目我已经做了一个授权类,但它不会为我工作,因为登录函数总是返回false 这是我的UserController.php 此外,my AppController.php还具有: 最后,我的模型文件是: public $validate = array( 'email' => array( 'required' => array( 'rule' => ar
public $validate = array(
'email' => array(
'required' => array(
'rule' => array("notEmpty"),
'message' => 'A E-mail field is required'
)
),'password' => array(
'required' => array(
'rule' => array("notEmpty"),
'message' => "A Password field is required"
)
)
);
我不确定这是否会有帮助,但您可能已经登录,请尝试使用注销。您是否在模型的beforeSave中哈希了密码字段?试试看,不行。我试着把它们混在一起,但还没有成功。
public $components = array(
'Session',
'Auth' => array(
'loginAction' => array(
'controller' => 'User',
'action' => 'login'
),
'loginRedirect' => array('controller' => 'User', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'User', 'action' => 'login'),
'authError' => "You can't acces that page",
'authorize' => array('Controller'),
));
public function isAuthorized(){
return TRUE;
}
public function beforeFilter() {
$this->Auth->authenticate = array('Form');
$this->Auth->allow('index', 'view');
}
public $validate = array(
'email' => array(
'required' => array(
'rule' => array("notEmpty"),
'message' => 'A E-mail field is required'
)
),'password' => array(
'required' => array(
'rule' => array("notEmpty"),
'message' => "A Password field is required"
)
)
);