Thursday, September 8, 2011

CakePHP 2.0.0 RC1 & Auth Component Error

Using the updated information provided @
https://github.com/cakephp/docs/blob/master/en/core-libraries/components/authentication.rst
I cannot seem to get the auth to work.

I am using standard post/form login with username/password

AppController.php:
...
public $components = array('Auth');
...


UsersController.php
...
public function login() {
if ($this->request->is('post')) {
if($this->Auth->login()) {
return $this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Username or password is
incorrect'), 'default', array(), 'auth');
}
}
}
...


When I try to login, I get the following fatal php error...
Fatal error: Cannot redeclare class User in /{path}/{app}/Model/
User.php on line 3

In my users controller, if I pass in $this->request->data['User'] to
$this->Auth->login(), I do not recieve the error, and it logs me in,
however, Auth::user() only contains the username and unhashed
password...

Any help would be awesome! I am liking the updates to 2.0 and am
excited to use it in my future projects!! :)

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: