中的用户已添加到数据库,但无法登录cakePHP2.6.0
有人能给我一个提示为什么我的登录不起作用吗 可以添加用户,还可以创建河豚密码并将中的数据集保存到数据库中,但我无法登录 模型 应用控制器中的用户已添加到数据库,但无法登录cakePHP2.6.0,cakephp,password-encryption,Cakephp,Password Encryption,有人能给我一个提示为什么我的登录不起作用吗 可以添加用户,还可以创建河豚密码并将中的数据集保存到数据库中,但我无法登录 模型 应用控制器 public $components = array( 'DebugKit.Toolbar', 'Session', 'Paginator' => array(
public $components = array(
'DebugKit.Toolbar',
'Session',
'Paginator' => array(
'className' => 'Bancha.BanchaPaginator'),
'Auth' => array(
'loginRedirect' => array(
'controller' => 'posts',
'action' => 'index'
),
'logoutRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish'
)
),
)
);
public function beforeFilter() {
$this->Auth->allow('index', 'view');
}
登录
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
}
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
登录ctp文件
<div class="users form">
<?php echo $this->Session->flash('auth'); ?>
<?php echo $this->Form->create('Benutzer'); ?>
<fieldset>
<legend>
<?php echo __('Please enter your username and password'); ?>
</legend>
<?php echo $this->Form->input('username', array('lable' => 'Username', 'type' => 'text'));?>
<?php echo $this->Form->input('passwort', array('lable' => 'Passwort', 'type' => 'password'));?>
</fieldset>
<?php echo $this->Form->end(__('Login')); ?>
</div>
问题是,我没有定义“字段”
'authenticate' => array(
'Form' => array(
'fields' => array(
'username' => 'username', //Default is 'username' in the userModel
'password' => 'passwort' //Default is 'password' in the userModel
)
数据库中密码的字段类型和长度是多少?
'authenticate' => array(
'Form' => array(
'fields' => array(
'username' => 'username', //Default is 'username' in the userModel
'password' => 'passwort' //Default is 'password' in the userModel
)