I have a simple form in my layout default.ctp, this is the code :
<li style="margin-top: 10px;">
<?php echo $this->Form->create('User', array('action' => 'login')); ?>
<?php echo $this->Form->input('email',array('label'=> false, 'class' => 'cnx', 'placeholder' => 'E-Mail', 'div' => false)); ?>
<?php echo $this->Form->input('password',array('label'=> false, 'type'=> 'password', 'class' => 'cnx', 'placeholder' => 'Mot de passe', 'div' => false)); ?>
<?php
$options = array('label' => 'Connexion', 'class' => 'btncnx', 'div' => false);
echo $this->Form->end($options);
?>
</li>
I want to call the action login from my UsersController. The only problem is when i click on the submit button is that CakePHP needs to set the view login . I don't want to create a login.ctp view ...
Missing View Error: The view for UsersController::login() was not found.
my function login in UsersController :
public function login(){
if($this->request->is('post')){
if($this->Auth->login()){
return $this->redirect($this->Auth->redirect());
}else{
$this->Session->setFlash("Votre login ou votre mot de passe ne correspond pas","notif",array('type'=>'error'));
}
}
}
How can i do it without creating a view ?
Thanks