default password in Yii using MySQL

Hi all,

I changed authenticate() method as follows,I am using MySQL, should I write some SQL statements to login.otherwise,what’s the default username and password?

public function authenticate()

    {


            /*$users=array(


                    // username => password


                    'demo'=>'demo',


                    'admin'=>'admin',


            );*/


            $username = strtolower($this->username);


            $user = User::model()->find('LOWER(username)=?',array($username));


            if($user === null)


            {


               $this->errorCode=self::ERROR_USERNAME_INVALID;


            }


            else if(!$user->validatePassword($this->password))


            {


               $this->errorCode=self::ERROR_PASSWORD_INVALID;


            }


            else


            {


               $this->_id = $user->id;


               $this->username = $user->username;


               $this->errorCode = self::ERROR_NONE;


            }


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


            /*


            if(!isset($users[$this->username]))


                    $this->errorCode=self::ERROR_USERNAME_INVALID;


            else if($users[$this->username]!==$this->password)


                    $this->errorCode=self::ERROR_PASSWORD_INVALID;


            else


                    $this->errorCode=self::ERROR_NONE;


            return !$this->errorCode;


            */


    }

What are you trying to do? and what’s does the validatePassword method do?

P.S

You should use the Code blocks for code as it can improve the readability of the code.