Has your user table a field called `username` ? On Sat, Aug 30, 2008 at 6:00 PM, Jeroen <[EMAIL PROTECTED]> wrote: > > I followed the instructions on http://book.cakephp.org/view/172/authentication > to create a login. The problem is that I get the following error when > I try to login: > SQL Error: 1054: Unknown column 'User.username' in 'where clause' [CORE > \cake\libs\model\datasources\dbo_source.php, line 512] > > Cake (Auth) searches for the wrong table to login, it need to search > for the table Users instead of User. > I'm using Cake version 1.2.0.7296 RC2. > > I use the following code: > class AppController extends Controller { > var $components = array('Auth'); > > function beforeFilter(){ > $this->Auth->loginAction = > array(Configure::read('Routing.admin') => > false, 'controller' => 'users', 'action' => 'login'); > $this->Auth->allow('index','view'); > } > > } > > Login view: > <?php > if ($session->check('Message.auth')) $session->flash('auth'); > echo $form->create('User',array('action' => 'login')); > echo $form->input('username'); > echo $form->input('password'); > echo $form->end('Login'); > ?> > > <?php > class UsersController extends AppController { > > var $name = 'Users'; > var $helpers = array('Html', 'Form', 'Session' ); > > /** > * The AuthComponent provides the needed functionality > * for login, so you can leave this function blank. > */ > function login() { > } > > function logout() { > $this->redirect($this->Auth->logout()); > } > > } > ?> > > I tried the following things: > 1. echo $form->create('Users',array('action' => 'login')); instead of > echo $form->create('User',array('action' => 'login'));, but then Auth > wopn't do anything at all. Comparing to other views the syntax echo > $form->create('User',array('action' => 'login')); should be the > correct synax. > 2. Searching the Internet if anyone else had the same problem, but I > can't find anyone with the same problem. > > Three questions > 1. Is this a bug of CakePHP 1.2.0.7296 RC2 or am I doing something > wrong? > 2. Is there amnyone else who uses the Auth-component successfully in > version 1.2.0.7296 RC2? > 3. The most important: anyone has a solution or got an idea?? :) > > Thanks, > > Jeroen > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
