Commit 8e2faa4e authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[FEATURE] Add error handling for transferLDAP Operation

parent 0d969b23
Pipeline #6600 passed with stages
in 2 minutes and 27 seconds
......@@ -119,20 +119,30 @@ class ReactivateUserHook implements \TYPO3\CMS\Backend\RecordList\RecordListGetT
$feUser = $this->userRepository->findByUid($recoverUser['uid']);
if ($feUser) {
if (GeneralUtility::validEmail($feUser->getEmail())) {
$ldapOperation = $this->objectManager->get(FeManagerHooks::class);
if ($ldapOperation->createUser($feUser)) {
$this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername());
try {
$ldapOperation = $this->objectManager->get(FeManagerHooks::class);
if ($ldapOperation->createUser($feUser)) {
$this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername());
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'LDAP Transfer'
);
} else {
$this->addFlashMessage(
'The user could not created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
'Error in LDAP Transfer'
);
}
} catch (\Exception $e) {
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'LDAP Transfer'
);
} else {
$this->addFlashMessage(
'The user could not created in LDAP',
$e->getMessage(),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
'Error in LDAP Transfer'
'Error ' . $e->getCode()
);
return false;
}
} else {
$this->addFlashMessage(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment