When I enter my login page, the warning message that the user or passwords are invalid appears soon, but this should only appear after clicking the button to sign in. Can not you get 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!'));
}
}