Only allow phone when we can save it
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
1246f0a77f
commit
2d08501be7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -26,6 +26,7 @@ declare(strict_types=1);
|
|||
namespace OCA\Registration\Settings;
|
||||
|
||||
use OCA\Registration\AppInfo\Application;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Services\IInitialState;
|
||||
use OCP\IConfig;
|
||||
|
|
@ -38,6 +39,8 @@ class RegistrationSettings implements ISettings {
|
|||
private $config;
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
/** @var IAccountManager */
|
||||
private $accountManager;
|
||||
/** @var IInitialState */
|
||||
private $initialState;
|
||||
/** @var string */
|
||||
|
|
@ -46,10 +49,12 @@ class RegistrationSettings implements ISettings {
|
|||
public function __construct(string $appName,
|
||||
IConfig $config,
|
||||
IGroupManager $groupManager,
|
||||
IAccountManager $accountManager,
|
||||
IInitialState $initialState) {
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->accountManager = $accountManager;
|
||||
$this->initialState = $initialState;
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +106,11 @@ class RegistrationSettings implements ISettings {
|
|||
'enforce_fullname',
|
||||
$this->config->getAppValue($this->appName, 'enforce_fullname', 'no') === 'yes'
|
||||
);
|
||||
// FIXME Always true when Nextcloud 22 or 21.0.1 is minimum requirement
|
||||
$this->initialState->provideInitialState(
|
||||
'can_show_phone',
|
||||
method_exists($this->accountManager, 'updateAccount')
|
||||
);
|
||||
$this->initialState->provideInitialState(
|
||||
'show_phone',
|
||||
$this->config->getAppValue($this->appName, 'show_phone', 'no') === 'yes'
|
||||
|
|
|
|||
|
|
@ -161,7 +161,8 @@
|
|||
<label for="enforce_fullname">{{ t('registration', 'Enforce full name field') }}</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<p
|
||||
v-if="canShowPhone">
|
||||
<input id="show_phone"
|
||||
v-model="showPhone"
|
||||
type="checkbox"
|
||||
|
|
@ -173,7 +174,7 @@
|
|||
</p>
|
||||
|
||||
<p
|
||||
v-if="showPhone"
|
||||
v-if="canShowPhone && showPhone"
|
||||
class="indent">
|
||||
<input id="enforce_phone"
|
||||
v-model="enforcePhone"
|
||||
|
|
@ -250,6 +251,7 @@ export default {
|
|||
usernamePolicyRegex: '',
|
||||
showFullname: false,
|
||||
enforceFullname: false,
|
||||
canShowPhone: false,
|
||||
showPhone: false,
|
||||
enforcePhone: false,
|
||||
additionalHint: '',
|
||||
|
|
@ -285,6 +287,7 @@ export default {
|
|||
this.usernamePolicyRegex = loadState('registration', 'username_policy_regex')
|
||||
this.showFullname = loadState('registration', 'show_fullname')
|
||||
this.enforceFullname = loadState('registration', 'enforce_fullname')
|
||||
this.canShowPhone = loadState('registration', 'can_show_phone')
|
||||
this.showPhone = loadState('registration', 'show_phone')
|
||||
this.enforcePhone = loadState('registration', 'enforce_phone')
|
||||
this.additionalHint = loadState('registration', 'additional_hint')
|
||||
|
|
|
|||
Loading…
Reference in New Issue