Skip to content

Commit

Permalink
Add AutologinBackendForm
Browse files Browse the repository at this point in the history
fixes #6434
  • Loading branch information
Al2Klimov committed Jul 25, 2014
1 parent 644b3a1 commit ed10e49
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions application/forms/Config/Authentication/AutologinBackendForm.php
@@ -0,0 +1,68 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}

namespace Icinga\Form\Config\Authentication;

use Zend_Validate_Callback;

class AutologinBackendForm extends BaseBackendForm
{
public function isValidAuthenticationBackend()
{
return true;
}

public function createElements(array $formData)
{
return array(
$this->createElement(
'text',
'name',
array(
'required' => true,
'allowEmpty' => false,
'label' => t('Backend Name'),
'helptext' => t('The name of this authentication backend'),
'value' => '',
'validators' => array(
array(
'Regex',
false,
array(
'pattern' => '/^[^\\[\\]:]+$/',
'messages' => array(
'regexNotMatch' => 'The backend name cannot contain \'[\', \']\' or \':\'.'
)
)
)
)
)
),
$this->createElement(
'text',
'strip_username_regexp',
array(
'required' => true,
'allowEmpty' => false,
'label' => t('Backend Domain Pattern'),
'helptext' => t('The domain pattern of this authentication backend'),
'value' => '/\@[^$]+$/',
'validators' => array(
new Zend_Validate_Callback(function ($value) {
return @preg_match($value, '') !== false;
})
)
)
),
$this->createElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'autologin'
)
)
);
}
}

0 comments on commit ed10e49

Please sign in to comment.