/** * Checks that the credentials entered are valid * @param string $attribute the attribute being validated ("username" in * this case) */ public function checkCredentials($attribute) { if (!$this->areAttributesValid(array('hostname', 'port', 'username', 'password'))) { return; } $webserver = new WebServer($this->hostname, $this->port); if (!$webserver->checkCredentials($this->username, $this->password)) { $this->addError($attribute, Yii::t('Backend', 'Invalid credentials')); } }