diff --git a/lib/Service/RegistrationService.php b/lib/Service/RegistrationService.php index 3831dec..fb5c5b0 100644 --- a/lib/Service/RegistrationService.php +++ b/lib/Service/RegistrationService.php @@ -354,7 +354,8 @@ class RegistrationService { $this->validateDisplayname($fullName); } - if ($this->config->getAppValue('registration', 'show_phone', 'no') === 'yes') { + if (class_exists(PhoneNumberUtil::class) + && $this->config->getAppValue('registration', 'show_phone', 'no') === 'yes') { if ($phone) { $this->validatePhoneNumber($phone); } elseif ($this->config->getAppValue('registration', 'enforce_phone', 'no') === 'yes') { diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php index 66b0a48..97001e3 100644 --- a/lib/Settings/RegistrationSettings.php +++ b/lib/Settings/RegistrationSettings.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OCA\Registration\Settings; +use libphonenumber\PhoneNumberUtil; use OCA\Registration\AppInfo\Application; use OCP\Accounts\IAccountManager; use OCP\AppFramework\Http\TemplateResponse; @@ -109,7 +110,7 @@ class RegistrationSettings implements ISettings { // FIXME Always true when Nextcloud 22 or 21.0.1 is minimum requirement $this->initialState->provideInitialState( 'can_show_phone', - method_exists($this->accountManager, 'updateAccount') + method_exists($this->accountManager, 'updateAccount') && class_exists(PhoneNumberUtil::class) ); $this->initialState->provideInitialState( 'show_phone',