Can't authenticate against DB

Hi there,

I’m trying to authenticate the user login with real data from DB, so I’ve commented the standard array admin/admin - demo/demo.

This is my table:




CREATE TABLE `user` (

  `User_ID` int(5) unsigned NOT NULL AUTO_INCREMENT,

  `Username` varchar(15) NOT NULL,

  `Password` varchar(15) NOT NULL,

  `Firstname` varchar(50) DEFAULT '',

  `Lastname` varchar(50) DEFAULT '',

  `Status_ID` tinyint(1) unsigned NOT NULL DEFAULT '1',

  PRIMARY KEY (`User_ID`)

) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8



As per indicacion here(http://www.yiiframework.com/doc/guide/1.1/en/topics.auth) I’ve added this line:


$users=User::model()->findByAttributes(array('username'=>$this->username));

but still doesn’t works.

It says "Incorrect username …" all the time.

It looks that the guide has the code for an older version, since I’m using 1.1.5

I’m not sure if the problem is the CamelCase in the fields names that differs from the standard ‘username’ & ‘password’.

Any clue?

TIA

Seems that $users is null…

Some ideas to try:

check your User model…

try to make a search with a username that you now exists in the database, for example if you have a username "admin" try with:


$users=User::model()->fyndByAttributes(array('username'=>'admin'));

just to get it working… then find why is not working…