LdapResourceForm: Remove hostname validator

It's now done automatically by the connection itself.

refs #3639
This commit is contained in:
Johannes Meyer 2019-04-23 10:56:05 +02:00
parent 1d341f9253
commit 1a030d3d65
1 changed files with 1 additions and 32 deletions

View File

@ -48,38 +48,7 @@ class LdapResourceForm extends Form
'The hostname or address of the LDAP server to use for authentication.'
. ' You can also provide multiple hosts separated by a space'
),
'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.'
)
)
)
)
)
'value' => 'localhost'
)
);
$this->addElement(