mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
LdapResourceForm: Remove hostname validator
It's now done automatically by the connection itself. refs #3639
This commit is contained in:
parent
1d341f9253
commit
1a030d3d65
@ -48,38 +48,7 @@ class LdapResourceForm extends Form
|
|||||||
'The hostname or address of the LDAP server to use for authentication.'
|
'The hostname or address of the LDAP server to use for authentication.'
|
||||||
. ' You can also provide multiple hosts separated by a space'
|
. ' You can also provide multiple hosts separated by a space'
|
||||||
),
|
),
|
||||||
'value' => 'localhost',
|
'value' => 'localhost'
|
||||||
'validators' => array(
|
|
||||||
array(
|
|
||||||
'Callback',
|
|
||||||
false,
|
|
||||||
array(
|
|
||||||
'callback' => function ($v) {
|
|
||||||
$withoutScheme = $withScheme = false;
|
|
||||||
foreach (explode(' ', $v) as $uri) {
|
|
||||||
if (preg_match('~^(?<!://)[^:]+:\d+$~', $uri)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = Url::fromPath($uri);
|
|
||||||
if ($url->getScheme()) {
|
|
||||||
$withScheme = true;
|
|
||||||
} else {
|
|
||||||
$withoutScheme = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $withScheme ^ $withoutScheme;
|
|
||||||
},
|
|
||||||
'messages' => array(
|
|
||||||
'callbackValue' => $this->translate(
|
|
||||||
'A protocol scheme such as ldap:// or ldaps:// is mandatory for URIs with a given'
|
|
||||||
. ' port and for all other URIs as well once a scheme is given for a single one.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user