Tuesday, February 28, 2012

Having issue with AUTH in 2.1

Hi,

as I only have to secure one controller, I put this into my
usersController:

class UsersController extends AppController {
var $name = 'User';
var $components = array('Auth');
public function beforeFilter() {
parent::beforeFilter();

$this->Auth->fields = array('username' => 'usr_username',
'password' => 'usr_password');
$this->Auth->allowedActions = array('display', 'index',
'add');
$this->Auth->autoRedirect = false;
$this->Auth->logoutRedirect = array('controller' =>
'bookmark', 'action' => 'search');
$this->Auth->loginRedirect = array('controller' => 'pages',
'action' => 'display', 'home');
}

But when I try to login, I get this sql error:

SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`,
`User`.`created` FROM `project`.`users` AS `User` WHERE
`User`.`username` = 'me' AND `User`.`password` =
'998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1

It looks to me as $this->Auth->fields is just ignored?

I went to the book and read about but I couldn't find a hint how else
to write it.
Anyone an idea?

--
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: