0
Hello, I’m new to Cakephp 3 and am having problems validating my login.ctp form, error: Undefined variable users in login.ctp.
I’d appreciate it if someone could help me validate;
login.ctp:
<br>
<div class="index large-4 medium-5 large-offset-4 medium-offset-4 columns">
<div class="panel">
<h2 class="text-center">Login</h2>
<?= $this->Form->create($user); ?>
<?php
echo $this->Form->input('email');
echo $this->Form->input('password');
?>
<?= $this->Form->submit('Login', array('class' => 'button')); ?>
<?= $this->Form->end(); ?>
</div>
</div>
login Function in Userscontroller.php:
public function login()
{
if($this->request->is('post'))
{
$user = $this->Auth->identify();
if($user)
{
$this->Auth->setUser($user);
return $this->redirect(['controller' => 'comentario']);
}
// Erro no Login
$this->Flash->error('Erro de autenticação');
}
}
This "<?=" statement, could you replace it with "<? php?? Might be being simplistic, but it would be my suggestion.
– Rodrigo Tognin