UserIdentity.php 552 B

1234567891011121314151617181920
  1. <?php
  2. class UserIdentity extends CUserIdentity
  3. {
  4. /**
  5. * Authenticates a user.
  6. * @return boolean whether authentication succeeds.
  7. */
  8. public function authenticate()
  9. {
  10. $password=Yii::app()->getController()->getModule()->password;
  11. if($password===null)
  12. throw new CException('Please configure the "password" property of the "gii" module.');
  13. elseif($password===false || $password===$this->password)
  14. $this->errorCode=self::ERROR_NONE;
  15. else
  16. $this->errorCode=self::ERROR_UNKNOWN_IDENTITY;
  17. return !$this->errorCode;
  18. }
  19. }