Hi,
I am new in cake and trying to implement user auth functionality but i
am stuck in a strange error for 3-4 hours. I have created my user
controller like below. As i understand i dont need to do manual
password and id checking inside Login function and it has to do
automatically. But every time when my form hits it returns me back to
the same login page and it never show error message inside session's
auth variable. Please help me what should i do?
///----------- USER CONTROLLER
class KUsersController extends AppController {
var $name = 'KUsers';
var $components = array('Auth',
'Recaptcha','RequestHandler','Email');//this auth has some requirement
we gotta learn it
var $helpers = array('Session','Ajax','Javascript');
function beforeFilter() {
$this->Auth->userModel = 'KUsers';
$this->Auth->loginAction = array('admin' => false,'controller'
=>
'KUsers', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'KUsers',
'action' => 'dashboard');
$this->Auth->loginError = 'No username and password was found
with
that combination.';
$this->Auth->logoutRedirect = '/';
$this->Auth->fields = array('k_userid' => 'k_userid', 'k_passw'
=>
'k_passw');
$this->Auth-
>allow('register','recaptcha','emailExist','accountNotice');//this
will let me allow which function publically available
}
function login() { }
function dashboard() { }
function logout() {
$this->redirect($this->Auth->logout());
}
//------------ LOGIN View
<?if ($session->check('Message.auth')) $session->flash('auth');?>
<?=$session->Flash("auth"); ?>
<?php echo $this->Form->create('KUser',array('action' => 'login'));?>
UserID<?echo $this->Form->input('k_userid',array( 'label' =>
'','id'=>'k_userid'));?>
Password<?echo $this->Form->input('k_passw',array( 'label' =>
'','type' => 'password','id'=>'k_passw'));?>
<input type="submit" class="btn" value="Sign in"/>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en