Add validation for application name.

refs #6129
This commit is contained in:
Matthias Jentsch 2014-05-12 15:40:59 +02:00
parent 87054c8121
commit 793a0a061f

View File

@ -30,7 +30,7 @@
namespace Icinga\Form\Config; namespace Icinga\Form\Config;
use Zend_Config; use \Zend_Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Web\Form\Validator\WritablePathValidator; use Icinga\Web\Form\Validator\WritablePathValidator;
@ -116,7 +116,19 @@ class LoggingForm extends Form
'required' => true, 'required' => true,
'label' => t('Application Prefix'), 'label' => t('Application Prefix'),
'helptext' => t('The name of the application by which to prefix syslog messages.'), 'helptext' => t('The name of the application by which to prefix syslog messages.'),
'value' => $loggingConfig->get('application', 'icingaweb') 'value' => $loggingConfig->get('application', 'icingaweb'),
'validators' => array(
array(
'Regex',
false,
array(
'pattern' => '/^[^\W]+$/',
'messages' => array(
'regexNotMatch' => 'The application prefix cannot contain any whitespaces.'
)
)
)
)
) )
); );
$this->addElement( $this->addElement(