CakePHP 3.0每次登录返回false


CakePHP 3.0 Login return every time false

我正在制作cakePhp 3项目,我无法登录。$this->Auth->indetify();总是返回false

查看其他人类似的问题,都建议把我的table.password放在数据库varchar(255)中,但这无济于事。

数据库表:

CREATE TABLE users (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
person_id BIGINT NOT NULL,
username VARCHAR(50),
password VARCHAR(255),
role VARCHAR(20),
active boolean DEFAULT TRUE NOT NULL
);

UsersControllers中的登录和注销函数

public function login() {
if ($this->request->is('post')) {
    $user = $this->Auth->identify();
    if ($user) {
        $this->Auth->setUser($user);
        return $this->redirect($this->Auth->redirectUrl());
    }
    $this->Flash->error(__('User and Password incorrect'));
}
public function logout() {
   return $this->redirect($this->Auth->logout());
}
public function beforeFilter(Event $event)
{
  parent::beforeFilter($event);
  $this->Auth->allow(['index', 'logout', 'add','login']);
}

有:

 public function initialize()
{
    parent::initialize();
    $this->loadComponent('RequestHandler');
    $this->loadComponent('Flash');
    $this->loadComponent('Auth',[
    'loginRedirect' => [
    'controller' => 'Users',
    'action' => 'index'
    ],
    'logoutRedirect' => [
    'controller' => 'Users',
    'action' => 'login'
    ]           
]); 

和我的/Users/login.ctp

<div class="users form">
<?= $this->Flash->render('auth') ?>
<?= $this->Form->create() ?>
     <fieldset>
        <legend><?= __('User and Password') ?></legend>
        <?= $this->Form->input('username') ?>
       <?= $this->Form->input('password') ?>
    </fieldset>
<?= $this->Form->button(__('Login')); ?>
<?= $this->Form->end() ?>
</div>

我遵循了一个教程,它带我到这个显然是工作= '

这可能听起来很愚蠢,但是密码是在数据库中散列的还是您手工以明文形式编写的?

密码有问题。CakePHP试图读取密码加密,但我的数据库已经有数据输入到它。谢谢