here is my task manager users_controller and user model. whenever i go
to login page and click on login i m unable to go to redirected page.
please help.

my code is

user model

<?php
class User extends Appmodel {
        var $validate = array(
        'firstname'=> array('rule'=> array('minlength',1),
        'message'=> 'firstname required'),
        'username'=> array('rule'=> array('minlength',1),
        'message'=> 'username required'),
        'password'=> array('rule'=> array('minlength',5),
        'message'=> 'password required'),
        'repeat_password' => array(
                        'rule' => array('CheckPasswordMatch'),
                        'message' => 'Passwords did not match'),
        'email'=> array('rule'=>'email',
                                        'message'=> 'email
required'));
var $name = 'User';

        var $hasMany= array(
        'Task'=> array(
        'classname'=>'Task',
        'order'=>'Task.start date',
        'dependent'=> 'true'
        )
        );
         function CheckPasswordMatch($data) {
                return $this->data['User']['password'] ==
                Security::hash($this->data['User']['repeat_password'],
null, true);
        }
}

?>

here is my users_controller

<?php
class UsersController extends AppController {
 var $helpers = array('html', 'form');
 var $components=array('Auth');

 function beforeFilter() {
            $this->Auth->allow('*');
        $this->Auth->fields = array(
            'username' => 'username',
            'password' => 'password'
            );
 }

        function add() {
         if(!empty($this->data)) {
        if($this->User->save($this->data)) {
           $this->Session->setFlash("User Saved!");
           $this->redirect(array('controller'=>'users',
'action'=>'login'));
     }
  }
}

function login()
    {
        if(!empty($this->data)) {
                if($this->Auth->login()) {
                        $this->Session->setFlash("Hello User");
                        $this->redirect(array('controller'=>'tasks',
'action'=>'add'));
                }
                else {
                        $this->Session->setFlash('here');
                }
        }
    }
function call() {
                       $this->User->find('all');
                }
}

?>

can u just check whats wromg with my login() function

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to