Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #6434
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
application/forms/Config/Authentication/AutologinBackendForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
) | ||
) | ||
); | ||
} | ||
} |