mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-07 05:54:25 +02:00
Fix that one can't advance the wizard when skipping the ldap discovery
fixes #8506
This commit is contained in:
parent
65eafc0e8f
commit
e9bae08a6e
@ -24,7 +24,6 @@ class LdapDiscoveryForm extends Form
|
|||||||
'text',
|
'text',
|
||||||
'domain',
|
'domain',
|
||||||
array(
|
array(
|
||||||
'required' => true,
|
|
||||||
'label' => $this->translate('Search Domain'),
|
'label' => $this->translate('Search Domain'),
|
||||||
'description' => $this->translate('Search this domain for records of available servers.'),
|
'description' => $this->translate('Search this domain for records of available servers.'),
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Setup\Forms;
|
namespace Icinga\Module\Setup\Forms;
|
||||||
|
|
||||||
|
use Zend_Validate_NotEmpty;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
use Icinga\Web\Form\ErrorLabeller;
|
||||||
use Icinga\Forms\LdapDiscoveryForm;
|
use Icinga\Forms\LdapDiscoveryForm;
|
||||||
use Icinga\Protocol\Ldap\Discovery;
|
use Icinga\Protocol\Ldap\Discovery;
|
||||||
use Icinga\Module\Setup\Forms\LdapDiscoveryConfirmPage;
|
use Icinga\Module\Setup\Forms\LdapDiscoveryConfirmPage;
|
||||||
@ -55,15 +57,11 @@ class LdapDiscoveryPage extends Form
|
|||||||
|
|
||||||
$discoveryForm = new LdapDiscoveryForm();
|
$discoveryForm = new LdapDiscoveryForm();
|
||||||
$this->addElements($discoveryForm->createElements($formData)->getElements());
|
$this->addElements($discoveryForm->createElements($formData)->getElements());
|
||||||
$this->getElement('domain')->setRequired(
|
|
||||||
isset($formData['skip_validation']) === false || ! $formData['skip_validation']
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'skip_validation',
|
'skip_validation',
|
||||||
array(
|
array(
|
||||||
'required' => true,
|
|
||||||
'label' => $this->translate('Skip'),
|
'label' => $this->translate('Skip'),
|
||||||
'description' => $this->translate('Do not discover LDAP servers and enter all settings manually.')
|
'description' => $this->translate('Do not discover LDAP servers and enter all settings manually.')
|
||||||
)
|
)
|
||||||
@ -82,19 +80,24 @@ class LdapDiscoveryPage extends Form
|
|||||||
if (false === parent::isValid($data)) {
|
if (false === parent::isValid($data)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($data['skip_validation']) {
|
if (isset($data['skip_validation']) && $data['skip_validation']) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['domain'])) {
|
if (isset($data['domain']) && $data['domain']) {
|
||||||
$this->discovery = Discovery::discoverDomain($data['domain']);
|
$this->discovery = Discovery::discoverDomain($data['domain']);
|
||||||
if ($this->discovery->isSuccess()) {
|
if ($this->discovery->isSuccess()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$this->addError(
|
$this->addError(
|
||||||
sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain'])
|
sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain'])
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$labeller = new ErrorLabeller(array('element' => $this->getElement('domain')));
|
||||||
|
$this->getElement('domain')->addError($labeller->translate(Zend_Validate_NotEmpty::IS_EMPTY));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user