我记录了用户填写的密码,它与我的数据库中的密码相同。但是,当我使用$ this-> Auth-> login()时,它无法登录。它不断返回虚假。当它返回false时,我会检查当前数据是什么($ this-> request-> data [' account'] [' password']这样做等于数据库中的密码。
有没有(简单的)方法从cakephp中删除has,所以我可以使用自己的?
我所说的代码如下:
public function index() {
if($this->Session->check('Auth.User')){
$this->redirect(array('controller' => 'Authentication', 'action' => 'test'));
}
if ($this->request->is('post')) {
$password = $this->request->data['account']['username'];
$this->hashPasswords($this->request->data);
if ($this->Auth->login()) {
$this->Session->setFlash(__('Welcome, '. $this->Auth->user('username')));
} else {
$this->Session->setFlash(__('Invalid username or password; '. $this->request->data['account']['username'] ."--". $this->request->data['account']['password'] ));
$this->request->data['account']['password'] = $password;
}
}
}