1
When I log in to my login page, the warning message appears that the user or passwords are invalid, but this should only appear after pressing the login button. There’s no way around this?
My view:
<div class="large-4 columns" style="margin-left: 15px;">
<div class="row">
<div class="users form">
<span class="login_form">
<?php echo $this->Session->flash(); ?></span>
<?php echo $this->Form->create('User');?>
<fieldset>
<?php echo $this->Form->input('email');
echo $this->Form->input('password');
?>
</fieldset>
<?php echo $this->Form->submit('Login', array('class' => 'button'));?>
</div>
</div>
My action: public Function login() {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Username ou password inválidos!'));
}
}
I have never worked with Cakephp, but it seems to me that he is already doing Ubmit when he loads the page, and since the fields are empty and the user is invalid it is an error. Now, I can’t give you a solution :/
– CesarMiguel
I think so too, but I don’t know why you’re doing Submit right away. It’s illogical.
– Ricardo Costa