public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); if (!$report->hasValidationErrors()) { if ($this->parameters['newPassword'] !== $this->parameters['confirmNewPassword']) { $report->addValidationErrorMessage($this, 'confirmNewPassword', 'ConfirmNoMatch_label'); } } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { if ($this->parameters['bootproto'] == 'dhcp') { unset($this->parameters['netmask']); unset($this->parameters['ipaddr']); unset($this->parameters['gateway']); } parent::validate($report); }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); if ($report->hasValidationErrors() || !$this->getRequest()->isMutation()) { return; } $passwordValidator = $this->getPlatform()->createValidator()->platform('password-strength', 'Users'); if ($this->parameters['newPassword'] !== $this->parameters['confirmNewPassword']) { $report->addValidationErrorMessage($this, 'confirmNewPassword', 'ConfirmNoMatch_label'); } elseif (!$passwordValidator->evaluate($this->stash->getFilePath())) { $report->addValidationError($this, 'newPassword', $passwordValidator); } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); if (!$this->getRequest()->isMutation()) { return; } $crtValidator = $this->createValidator()->platform('pem-certificate'); $keyValidator = $this->createValidator()->platform('rsa-key'); if (!$crtValidator->evaluate($_FILES['crt']['tmp_name'])) { $report->addValidationError($this, 'UploadCrt', $crtValidator); } if (!$keyValidator->evaluate($_FILES['key']['tmp_name'])) { $report->addValidationError($this, 'UploadKey', $keyValidator); } if (file_exists(sprintf('/etc/pki/tls/certs/%s.crt', $this->parameters['UploadName']))) { $report->addValidationErrorMessage($this, 'UploadName', 'vaild_UploadName_file_exists'); } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { if ($this->parameters['type'] == 'bond') { $this->getValidator('bond')->notEmpty(); } if ($this->parameters['type'] == 'bridge') { $this->getValidator('bridge')->notEmpty(); } if ($this->getRequest()->isMutation() && $this->parameters['type'] == 'xdsl') { $hasXdsl = $this->getPlatform()->getDatabase('networks')->getType('ppp0') === 'xdsl'; if ($hasXdsl) { $report->addValidationErrorMessage($this, 'xdsl', 'valid_pppoe_already_configured'); } elseif ($this->parameters['role'] !== 'red') { $report->addValidationErrorMessage($this, 'role', 'valid_pppoe_red_role_only'); } } parent::validate($report); }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); $hostNames = array_filter(preg_split("/[,\\s]+/", $this->parameters['SubjectAltName']), function ($v) { return preg_match("/[a-zA-Z]/", $v); }); $validator = $this->createValidator()->hostname(1); foreach ($hostNames as $origHostName) { $hostName = trim($origHostName); if (substr($hostName, 0, 2) === '*.') { $hostName = substr($hostName, 2); } if (!$validator->evaluate($hostName)) { $report->addValidationErrorMessage($this, 'SubjectAltName', 'valid_hostname_instance', array($origHostName)); break; } } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { $this->innerAction->validate($report); $this->plugins->validate($report); }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { $this->getValidator('successor')->memberOf(array_merge(array(''), $this->getDeviceParts($this->parameters['device']))); parent::validate($report); }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); // we must explicitly validate the pseudonym parameter because is not posted with create request if ($this->getRequest()->isMutation() && $this->getIdentifier() === 'create' && $this->parameters['CreateAlias'] === 'enabled') { if ($this->getValidator('pseudonym')->evaluate($this->parameters['pseudonym']) !== TRUE) { $report->addValidationErrorMessage($this, 'localAddress', 'valid_email,malformed-localpart'); } elseif ($this->getIdentifier() === 'create' && $this->getParent()->getAdapter()->offsetExists($this->parameters['pseudonym'])) { $report->addValidationErrorMessage($this, 'localAddress', 'valid_pseudonym_unique'); } } }