Fix that the ldap port does not change when updating the encryption to use

fixes #8958
This commit is contained in:
Johannes Meyer 2015-04-07 15:06:32 +02:00
parent dc4d1246a9
commit 62bb35a71e
1 changed files with 9 additions and 4 deletions

View File

@ -27,6 +27,10 @@ class LdapResourceForm extends Form
*/
public function createElements(array $formData)
{
$defaultPort = ! array_key_exists('encryption', $formData) || $formData['encryption'] !== Connection::LDAPS
? 389
: 636;
$this->addElement(
'text',
'name',
@ -52,10 +56,11 @@ class LdapResourceForm extends Form
'number',
'port',
array(
'required' => true,
'label' => $this->translate('Port'),
'description' => $this->translate('The port of the LDAP server to use for authentication'),
'value' => 389
'required' => true,
'preserveDefault' => true,
'label' => $this->translate('Port'),
'description' => $this->translate('The port of the LDAP server to use for authentication'),
'value' => $defaultPort
)
);
$this->addElement(