First of all load the component in the controller lets say UsersController using the below code
$this->uses=array(Auth);
login.view:
<?php
echo $this->Form->create('User', array('id'=>'signUpForm','name'=>'userSignupForm', 'action'=>'login')); ?>
<dl>
<dt>User Name:</dt>
<dd ><?php echo $this->Form->input('User.username', array('type'=>'text', 'label'=>false, 'div'=>false))?></dd>
<dt>Password:</dt>
<dd><?php echo $this->Form->input('User.password', array( 'type'=>'password','label'=>false, 'div'=>false)); ?></dd>
</dl>
<?php echo $this->Form->end('Login'); ?>
Write the code in login action of UsersController:
$this->Auth->login();
It will return 0= If logged in failed.
Otherwise 1 if successfull.
0 Comment(s)