yii blog tutorial login question


It may have been asked already but I can’t find it in the forums so here goes,

when reading the blog tutorial you com across this:

	public function authenticate($attribute,$params)


			$identity=new MUserIdentity($this->username,$this->password);


			switch($this->errorCode = $identity->errorCode)


				case MUserIdentity::ERROR_NONE:

					$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days



			        case MUserIdentity::USER_TO_BE_REGISTERED:


				default: // UserIdentity::ERROR_PASSWORD_INVALID

					$this->addError('password','Password is incorrect.');





i don’t understand this: public function authenticate($attribute,$params)

well actually i do know it’s a function and that values are being given to the code within but, what values and why in the other files can’t i see anything that is given to it? at a certain point i just see ->authenticate(); and nothing else…

plz help me,


The rules() method in LoginForm.php defines authenticate as custom validation method for the attribute password. These methods are called with the name of the attribute that should be validated and its value. See here for a more detailled explanation: