On Wed, Jul 21, 2010 at 12:35 PM, markatto <[email protected]> wrote: > My automagic login function is generating malformed sql queries, for > example: "SELECT FROM `users` AS `User` WHERE `User`.`username` = > 'user2' AND `User`.`password` = > 'a87e0c9a0bcd15c86f7e319c87955c41cf1dc16f' LIMIT 1" > > The problem obviously is that there is nothing between 'SELECT' and > 'FROM', which leads me to believe that some variable is not getting > set. Both the username and the password sections are correct; manually > inserting a * allows me to manually run the query successfully. > > Relevant stuff: > > login() is an empty function. > > Auth setup in the controller: > > function beforeFilter() > { > $this->Auth->loginAction = > array('controller'=>'users','action'=>'login'); > $this->Auth->allow('register'); > $this->Auth->redirectLogin = > array('controller'=>'professor','action'=>'index'); > }
This is in UsersController or AppController? I would put allow() (pass it an array, not a string, btw) in the former and the other two in the latter. And it should be loginRedirect, not redirectLogin. > Cake debug stuff: > > DboSource::showQuery() - CORE/cake/libs/model/datasources/ > dbo_source.php, line 549 > DboSource::execute() - CORE/cake/libs/model/datasources/ > dbo_source.php, line 216 > DboSource::fetchAll() - CORE/cake/libs/model/datasources/ > dbo_source.php, line 354 > DboSource::read() - CORE/cake/libs/model/datasources/dbo_source.php, > line 680 > Model::find() - CORE/cake/libs/model/model.php, line 2067 > AuthComponent::identify() - CORE/cake/libs/controller/components/ > auth.php, line 857 > AuthComponent::login() - CORE/cake/libs/controller/components/ > auth.php, line 664 > AuthComponent::startup() - CORE/cake/libs/controller/components/ > auth.php, line 352 > Component::startup() - CORE/cake/libs/controller/component.php, line > 121 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 223 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 206 > [main] - APP/webroot/index.php, line 87 > Query: SELECT FROM `users` AS `User` WHERE `User`.`username` = > 'user2' AND `User`.`password` = > 'a87e0c9a0bcd15c86f7e319c87955c41cf1dc16f' LIMIT 1 > > As far as I can tell, there is nothing interesting going on in the > user model. Which DB are you using? Which version of Cake? Try deleting everything in tmp/cache/[models|persistent] directories. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
