cakephp redirect query
creating a basic log in page - it was working but then we changed our database and our redirect is no longer working. if we put in the incorrect password or username we get an error message saying that the username/password is incorrect. - it is connecting to the database but when you click login it doesn't take us to our homepage. 

we want the user when they log into the site to get redirected to the eboxs(controller) home(view).

here is the code in the controller for logging in

    public function login() {
    	
    	$this->set('title_for_layout', 'Individual Registration');
    	$this->set('stylesheet_used', 'style');
    	$this->set('image_used', 'eBOXLogo.jpg');
    			
    	if ($this->request->is('post')){
    	if ($this->request->data['User']['password'] == 'qazwsx'){
       	if ($this->Auth->login()){
    	$username = $this->request->data['User']['username'];
    	 if (0 === $this->User->find('count',array('conditions'=>array('activated'=>true,'username'=> $username)))) {
    	 
             $this->Session->setFlash('Sorry, your account is not validated yet.');
    		 $this->redirect($this->referer());
        }
    		$this->Auth->user('id');
    		$this->redirect($this->Auth->redirect('Eboxs/home')); 
    		}	
        } 
    	else {
    	
            $this->Session->setFlash('Username or password is incorrect');
        }
    	}else{
    	$this->Session->setFlash('Welcome, please login');
    	}
    	
    	
    }


here is the code for the view


    <?php 	 
             echo $this->Form->create('User', array('action' => 'login'));
             echo $this->Form->input('username');
             echo $this->Form->input('password');
             echo $this->Form->end('Login');
    	
         ?> 


cakephp redirect query
===

creating a basic log in page - it was working but then we changed our database and our redirect is no longer working. if we put in the incorrect password or username we get an error message saying that the username/password is incorrect. - it is connecting to the database but when you click login it doesn't take us to our homepage. 

we want the user when they log into the site to get redirected to the eboxs(controller) home(view).

here is the code in the controller for logging in

    public function login() {
    	
    	$this->set('title_for_layout', 'Individual Registration');
    	$this->set('stylesheet_used', 'style');
    	$this->set('image_used', 'eBOXLogo.jpg');
    			
    	if ($this->request->is('post')){
    	if ($this->request->data['User']['password'] == 'qazwsx'){
       	if ($this->Auth->login()){
    	$username = $this->request->data['User']['username'];
    	 if (0 === $this->User->find('count',array('conditions'=>array('activated'=>true,'username'=> $username)))) {
    	 
             $this->Session->setFlash('Sorry, your account is not validated yet.');
    		 $this->redirect($this->referer());
        }
    		$this->Auth->user('id');
    		$this->redirect($this->Auth->redirect('Eboxs/home')); 
    		}	
        } 
    	else {
    	
            $this->Session->setFlash('Username or password is incorrect');
        }
    	}else{
    	$this->Session->setFlash('Welcome, please login');
    	}
    	
    	
    }


here is the code for the view


    <?php 	 
             echo $this->Form->create('User', array('action' => 'login'));
             echo $this->Form->input('username');
             echo $this->Form->input('password');
             echo $this->Form->end('Login');
    	
         ?> 

