25 array(
'username, password',
'required'),
27 array(
'rememberMe',
'boolean'),
29 array(
'password',
'authenticate'),
39 'rememberMe'=>
'Remember me next time',
49 if(!$this->hasErrors())
51 $this->_identity=
new UserIdentity($this->username,$this->password);
52 if(!$this->_identity->authenticate())
53 $this->addError(
'password',
'Incorrect username or password.');
63 if($this->_identity===null)
65 $this->_identity=
new UserIdentity($this->username,$this->password);
66 $this->_identity->authenticate();
68 if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
70 $duration=$this->rememberMe ? 3600*24*30 : 0;
71 Yii::app()->user->login($this->_identity,$duration);