From 4f3872e0e3af5bc41eeaeec8a0188684986167dd Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 11 Jun 2024 05:50:38 +0530 Subject: [PATCH] config changs --- lib/Listeners/UserConfigChangedListener.php | 5 +++++ lib/Service/RecoveryEmailService.php | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Listeners/UserConfigChangedListener.php b/lib/Listeners/UserConfigChangedListener.php index bfce357..10d845d 100644 --- a/lib/Listeners/UserConfigChangedListener.php +++ b/lib/Listeners/UserConfigChangedListener.php @@ -31,5 +31,10 @@ class UserConfigChangedListener implements IEventListener { $this->recoveryEmailService->sendVerificationEmail($user, $newRecoveryEmail); } } + if ($event->getKey() === 'recovery-email') { + $user = $event->getUserId(); + $newRecoveryEmail = $event->getValue(); + $this->recoveryEmailService->updateRecoveryEmailAtLDAPServer($user, $newRecoveryEmail); + } } } diff --git a/lib/Service/RecoveryEmailService.php b/lib/Service/RecoveryEmailService.php index 4b6e29f..3ed2384 100644 --- a/lib/Service/RecoveryEmailService.php +++ b/lib/Service/RecoveryEmailService.php @@ -127,16 +127,12 @@ class RecoveryEmailService { } public function updateRecoveryEmail(string $username, string $recoveryEmail) : void { - $user = $this->userManager->get($username); - if ($this->LDAPConnectionService->isUserOnLDAPBackend($user) && $this->LDAPConnectionService->isLDAPEnabled()) { - $this->updateRecoveryEmailAtLDAPServer($username, $recoveryEmail); - } $this->setUnverifiedRecoveryEmail($username, $recoveryEmail); $this->setRecoveryEmail($username, ''); } - private function updateRecoveryEmailAtLDAPServer(string $username, $recoveryEmail) { + public function updateRecoveryEmailAtLDAPServer(string $username, $recoveryEmail) { $conn = $this->LDAPConnectionService->getLDAPConnection(); $userDn = $this->LDAPConnectionService->username2dn($username); $entry = [ -- GitLab