蛋糕php 3.4登录不工作?
appcontroller页面 Model/entity/user.php login.ctp蛋糕php 3.4登录不工作?,php,mysql,cakephp,Php,Mysql,Cakephp,appcontroller页面 Model/entity/user.php login.ctp 即使输入了正确的密码,它也无法进行日志记录。有什么问题吗?我尝试登录很长一段时间,但总是失败。哈希中使用大写字母“H”hash@AmanRawatPHP类方法不区分大小写。 public function initialize() { parent::initialize(); $this->loadComponent('RequestHandler'); $this-
即使输入了正确的密码,它也无法进行日志记录。有什么问题吗?我尝试登录很长一段时间,但总是失败。哈希中使用大写字母“H”hash@AmanRawatPHP类方法不区分大小写。
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
$this->loadComponent('Auth',[
'authenticate'=>[
'Form'=>[
'Fields' => [
'username'=>'email',
'password'=>'password'
]
]
],
'loginAction'=>[
'controller'=>'Users',
'action' =>'login'
]
]);
}
protected function _setPassword($password){
return(new DefaultPasswordHasher)->Hash($password);
}
<br>
<div class="index large-4 medium-4 large-offset-4 medium-offset-4 columns">
<div class="panel">
<h2 class="text-center">Login </h2>
<?= $this->Form->create(); ?>
<?= $this->Form->input('email'); ?>
<?= $this->Form->input('password',array('type'=>'password')); ?>
<?= $this->Form->submit('Login',array('class'=>'button')); ?>
<?= $this->Form->end(); ?>
</div>
</div>
public function login(){
if($this->request->is('post'))
{
$user = $this->Auth->identify();
if($user)
{
$this->Auth->setUser($user);
return $this->redirect(['controller'=>'posts']);
}
else
{
$this->Flash->error('Incorrect Login Username and password in Tokyo');
}
}
}