From 2b8dc3c4cc289fa07aa601549774304a872f7c65 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 31 Mar 2021 15:27:24 +0200 Subject: [PATCH] Don't break with older versions Signed-off-by: Joas Schilling --- lib/Service/RegistrationService.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/Service/RegistrationService.php b/lib/Service/RegistrationService.php index 89a225c..f453a23 100644 --- a/lib/Service/RegistrationService.php +++ b/lib/Service/RegistrationService.php @@ -386,15 +386,17 @@ class RegistrationService { } // Set phone number in account data - $account = $this->accountManager->getAccount($user); - $property = $account->getProperty(IAccountManager::PROPERTY_PHONE); - $account->setProperty( - IAccountManager::PROPERTY_PHONE, - $phone, - $property->getScope(), - IAccountManager::NOT_VERIFIED - ); - $this->accountManager->updateAccount($account); + if (method_exists($this->accountManager, 'updateAccount')) { + $account = $this->accountManager->getAccount($user); + $property = $account->getProperty(IAccountManager::PROPERTY_PHONE); + $account->setProperty( + IAccountManager::PROPERTY_PHONE, + $phone, + $property->getScope(), + IAccountManager::NOT_VERIFIED + ); + $this->accountManager->updateAccount($account); + } // Add user to group $registeredUserGroup = $this->config->getAppValue($this->appName, 'registered_user_group', 'none');