Fix compatibility with Nextcloud 20
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
2747ad7fd2
commit
4430d2b497
|
|
@ -354,7 +354,8 @@ class RegistrationService {
|
||||||
$this->validateDisplayname($fullName);
|
$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) {
|
if ($phone) {
|
||||||
$this->validatePhoneNumber($phone);
|
$this->validatePhoneNumber($phone);
|
||||||
} elseif ($this->config->getAppValue('registration', 'enforce_phone', 'no') === 'yes') {
|
} elseif ($this->config->getAppValue('registration', 'enforce_phone', 'no') === 'yes') {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Registration\Settings;
|
namespace OCA\Registration\Settings;
|
||||||
|
|
||||||
|
use libphonenumber\PhoneNumberUtil;
|
||||||
use OCA\Registration\AppInfo\Application;
|
use OCA\Registration\AppInfo\Application;
|
||||||
use OCP\Accounts\IAccountManager;
|
use OCP\Accounts\IAccountManager;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
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
|
// FIXME Always true when Nextcloud 22 or 21.0.1 is minimum requirement
|
||||||
$this->initialState->provideInitialState(
|
$this->initialState->provideInitialState(
|
||||||
'can_show_phone',
|
'can_show_phone',
|
||||||
method_exists($this->accountManager, 'updateAccount')
|
method_exists($this->accountManager, 'updateAccount') && class_exists(PhoneNumberUtil::class)
|
||||||
);
|
);
|
||||||
$this->initialState->provideInitialState(
|
$this->initialState->provideInitialState(
|
||||||
'show_phone',
|
'show_phone',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue