LdapResourceForm: Display exact error messages to the user

This commit is contained in:
Johannes Meyer 2015-06-23 14:08:50 +02:00
parent 9d6d76a26d
commit 5fd2eb639a

View File

@ -156,13 +156,8 @@ class LdapResourceForm extends Form
{ {
try { try {
$resource = ResourceFactory::createResource(new ConfigObject($form->getValues())); $resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
if (false === $resource->testCredentials( $resource->connect();
$form->getElement('bind_dn')->getValue(), $resource->bind();
$form->getElement('bind_pw')->getValue()
)
) {
throw new Exception(); // TODO: Get the exact error message
}
} catch (Exception $e) { } catch (Exception $e) {
$msg = $form->translate('Connectivity validation failed, connection to the given resource not possible.'); $msg = $form->translate('Connectivity validation failed, connection to the given resource not possible.');
if (($error = $e->getMessage())) { if (($error = $e->getMessage())) {