0
我会看到这样一个登录,我根据文档跟踪了所有步骤,唯一的区别是我的登录名是除了我的项目结构中的默认布局之外的另一个双关语我有些东西不验证用户cakephp 3
\程序\ SRC \ Tempalte \布局\ default.thtml中public.ctp
以及在那里我的布局,现在的权威性组件
class AppController extends Controller {
$this->loadComponent('Auth',[
'authorize' => ['Controller'],
'authenticate' => [
'Form' => [
'userModel' => 'Usuarios',
'fields' => [
'username' => 'usuario',
'password' => 'password'
]
]
],
'loginAction' => [
'controller' => 'Usuarios',
'action' => 'login'
],
'authError' => 'Ingrese Datos',
'loginRedirect' => [
'controller' => 'Portal',
'action' => 'dashboard'
],
]);
}
我控制器用户
public function login() {
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
} else {
$this->Flash->error('Usuario y/o clave inválido',['key' => 'auth']);
}
}
$this->viewBuilder()->layout('public');
}
我的布局,市民会来我的登录
<?= $this->Flash->render('auth') ?>
<?= $this->Form->create() ?>
<div class="form-group">
<div class="input-group">
<i class="input-group-addon icon-user"></i>
<?= $this->Form->text('usuario',['placeholder' => 'Usuario','class'=>'form-control']) ?>
</div>
</div>
<div class="form-group">
<div class="input-group">
<i class="input-group-addon icon-key"></i>
<?= $this->Form->password('password',['placeholder' => 'Contraseña','class'=>'form-control']) ?>
</div>
</div>
<div class="form-group">
<?= $this->Html->link('Olvidaste tu Contraseña','/usuarios/password');?>
<?= $this->Form->button('Ingresar',['class'=>'btn btn-inverse btn-right'])?>
</div>
<?= $this->Form->end()?>
负载的一切,但始终将消息发送Usuario Y /Ø釜inválido
这是我的表
CREATE TABLE IF NOT EXISTS `usuario` (
`id_usuario` int(11) NOT NULL,
`usuario` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
我不应该错过更多的应该工作或什么曾经做错了,请帮助
探测感谢您的解决方案改变我的字段中的字符数是问题 –