Authentication Against Db With Yii

Right now, I am successfully able to create a user in my users table.

I am using a randomly generated salt, and then the store password is salted as well.

When checking with just basic PHP, I can able to regenerate the salted password with the stored salt.

I can not for the life of me get this to work by logging in.

This is my code for UserIdentity:


class UserIdentity extends CUserIdentity

{

        

        private $_id;   

          

 		public function authenticate()  

        {  

                $user=Users::model()->findbyAttributes(array('username'=>$this->username));

  

                if($user===null)  

                    {  

         				$this->errorCode=self::ERROR_USERNAME_INVALID;  

                    }  

                else if(SHA1($this->password.$user->salt)!==$user->password)  

                    {  

         				$this->errorCode=self::ERROR_PASSWORD_INVALID;          

                    }  

                else 	$this->errorCode=self::ERROR_NONE;  

  

                return !$this->errorCode;  

        } 

                

                public function getId()

        {

                return $this->_id;

        }


}

I am not receiving an incorrect password message when logging in. I am simply redirected to the loginForm, which leads me to believe that it is recognizing that the salted loginForm password is matching the salted DB password.

What other bits of code could I share to help to help figure out what I’m doing wrong. Obviously, I am still very new to Yii and appreciate all the help the forums offer. I have tried 8 different suggestions through the forum, yet none have helped with what I’m doing.

Thank you in advance.

Actually this worked fine. The problem was in the permissions in my user controller. In case anyone else was having this problem.

edit… it’s not throwing an error, but the menu is still not switching to Logout. Still says login.

ps. Sorry for dominating this post. I thought I had it solved and wanted to share.