i m trying to make a taskmanager and whenever i login i reach to the
login page instead of redirecting to task page

here is my 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');
                }
}
?>

and i have tasks_controller and task model and proper views for each..

can u depict the error???

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to