2014-04-19 09:39:15
public function  changepassword()
	{
		$this->layout = 'home';
		if ($this->Auth->user('id')) {   // Just to  make sure User is logged 
            $this->User->id = $this->Auth->user('id');  // Set User Id
            if (!$this->User->exists()) {
                throw new NotFoundException(__('Invalid user'));
            }
            if ($this->request->is('post') || $this->request->is('put') ) {
 
            	  	if ( !$this->User->checkCurrentPassword($this->request->data)) {
				    		 $this->Session->setFlash('Current password is corect !.');
				   	 }
            	 	elseif ($this->data['User']['password'] != $this->data['User']['password_confirmation'])
            	   	{
				         $this->Session->setFlash('Password confirmation is not match !.');
				         $this->id = AuthComponent::user('id');
				    }
 
				     elseif ($this->User->save($this->request->data,false)) {
	                    $this->Session->setFlash('Password has been changed.');
	                } else {
	                    $this->Session->setFlash('<b>Password could not be changed.</b>');
	                }
            } else {
//                $this->data = $this->User->findById($this->Auth->user('id'));
            }
        }
	}
Invalid Email or Password