Have you do this ?

        function beforeFilter()
        {
                $this->Auth->authenticate = array(
                        'Form' => array('userModel' => 'User')
                );
        }

On Oct 19, 1:21 pm, zuha <[email protected]> wrote:
> For some reason the UsersController after login is not finding the User
> model.  
>
> *// UsersController.php*
>
> public function login() {  
> if (!empty($this->request->data)) {
> if ($this->Auth->login()) {
> try {
> $this->User->loginMeta($this->request->data);
>                  return $this->redirect($this->Auth->redirect());} catch 
> (Exception $e) {
>
> $this->Session->setFlash($e->getMessage());
> $this->Auth->logout();}
>
>     } else {
>         $this->Session->setFlash(__('Username or password is incorrect'),
> 'default', array(), 'auth');
>     }
>
> }
> }
>
> */// Error Output*
>
> *Notice* (8): Array to string conversion 
> [*CORE\Cake\Model\Datasource\DboSource.php*, line *436*]
> Code Context
>
> PDOStatement::execute() - [internal], line ??
> DboSource::_execute() - CORE\Cake\Model\Datasource\DboSource.php, line 436
> DboSource::execute() - CORE\Cake\Model\Datasource\DboSource.php, line 403
> DboSource::fetchAll() - CORE\Cake\Model\Datasource\DboSource.php, line 645
> DboSource::query() - CORE\Cake\Model\Datasource\DboSource.php, line 587
> Model::__call() - CORE\Cake\Model\Model.php, line 720
> AppModel::loginMeta() - APP\Plugin\Users\Controller\UsersController.php, line 
> 48
> UsersController::login() - APP\Plugin\Users\Controller\UsersController.php, 
> line 48
> ReflectionMethod::invokeArgs() - [internal], line ??
> Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 473
> Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 107
> Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 89
> [main] - APP\webroot\index.php, line 125
>
> Notice how in that output it goes to AppModel::loginMeta()  after the
> UsersController::login()?   When my code clearly says
> : $this->User->loginMeta($this->request->data);  which is a call to the
> UserModel.   It should say UserModel::loginMeta() not
> AppModel::loginMeta().
>
> BTW...  I put some text in the User.php file that should throw a fatal error
> if the file is being loaded, and it does not throw the Fatal error.  
> Instead it brings me back to the login page with this output in the flash
> message.
>
> *SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error
> in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near 'loginMeta' at line 1*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to