diff --git a/lib/Controller/RegisterController.php b/lib/Controller/RegisterController.php
index 45d1f32..bf7e9fe 100644
--- a/lib/Controller/RegisterController.php
+++ b/lib/Controller/RegisterController.php
@@ -234,9 +234,9 @@ class RegisterController extends Controller {
'email_is_login' => $this->config->getAppValue('registration', 'email_is_login', 'no') === 'yes',
'loginname' => $loginname,
'fullname' => $fullname,
- 'show_fullname' => $this->config->getAppValue('registration', 'enfore_fullname', 'no') === 'yes',
+ 'show_fullname' => $this->config->getAppValue('registration', 'show_fullname', 'no') === 'yes',
'phone' => $phone,
- 'show_phone' => $this->config->getAppValue('registration', 'enfore_phone', 'no') === 'yes',
+ 'show_phone' => $this->config->getAppValue('registration', 'show_phone', 'no') === 'yes',
'message' => $message,
'password' => $password,
'additional_hint' => $additional_hint,
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 66ab814..33ae0f0 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -61,6 +61,10 @@ class SettingsController extends Controller {
string $username_policy_regex,
?bool $admin_approval_required,
?bool $email_is_login,
+ ?bool $show_fullname,
+ ?bool $enforce_fullname,
+ ?bool $show_phone,
+ ?bool $enforce_phone,
?bool $domains_is_blocklist,
?bool $show_domains,
?bool $disable_email_verification) {
@@ -101,6 +105,10 @@ class SettingsController extends Controller {
$this->config->setAppValue($this->appName, 'admin_approval_required', $admin_approval_required ? 'yes' : 'no');
$this->config->setAppValue($this->appName, 'email_is_login', $email_is_login ? 'yes' : 'no');
+ $this->config->setAppValue($this->appName, 'show_fullname', $show_fullname ? 'yes' : 'no');
+ $this->config->setAppValue($this->appName, 'enforce_fullname', $enforce_fullname ? 'yes' : 'no');
+ $this->config->setAppValue($this->appName, 'show_phone', $show_phone ? 'yes' : 'no');
+ $this->config->setAppValue($this->appName, 'enforce_phone', $enforce_phone ? 'yes' : 'no');
$this->config->setAppValue($this->appName, 'domains_is_blocklist', $domains_is_blocklist ? 'yes' : 'no');
$this->config->setAppValue($this->appName, 'show_domains', $show_domains ? 'yes' : 'no');
$this->config->setAppValue($this->appName, 'disable_email_verification', $disable_email_verification ? 'yes' : 'no');
diff --git a/lib/Service/RegistrationService.php b/lib/Service/RegistrationService.php
index f453a23..3831dec 100644
--- a/lib/Service/RegistrationService.php
+++ b/lib/Service/RegistrationService.php
@@ -349,14 +349,17 @@ class RegistrationService {
$this->validateUsername($loginName);
- if ($this->config->getAppValue('registration', 'enfore_fullname', 'no') === 'yes') {
+ if ($this->config->getAppValue('registration', 'show_fullname', 'no') === 'yes'
+ && $this->config->getAppValue('registration', 'enforce_fullname', 'no') === 'yes') {
$this->validateDisplayname($fullName);
}
- if ($phone) {
- $this->validatePhoneNumber($phone);
- } elseif ($this->config->getAppValue('registration', 'enfore_phone', 'no') === 'yes') {
- throw new RegistrationException($this->l10n->t('Please provide a valid phone number.'));
+ if ($this->config->getAppValue('registration', 'show_phone', 'no') === 'yes') {
+ if ($phone) {
+ $this->validatePhoneNumber($phone);
+ } elseif ($this->config->getAppValue('registration', 'enforce_phone', 'no') === 'yes') {
+ throw new RegistrationException($this->l10n->t('Please provide a valid phone number.'));
+ }
}
/* TODO
@@ -381,12 +384,14 @@ class RegistrationService {
}
// Set display name
- if ($fullName) {
+ if ($fullName && $this->config->getAppValue('registration', 'show_fullname', 'no') === 'yes') {
$user->setDisplayName($fullName);
}
// Set phone number in account data
- if (method_exists($this->accountManager, 'updateAccount')) {
+ if (method_exists($this->accountManager, 'updateAccount')
+ && $phone
+ && $this->config->getAppValue('registration', 'show_phone', 'no') === 'yes') {
$account = $this->accountManager->getAccount($user);
$property = $account->getProperty(IAccountManager::PROPERTY_PHONE);
$account->setProperty(
diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php
index 5036537..edebd13 100644
--- a/lib/Settings/RegistrationSettings.php
+++ b/lib/Settings/RegistrationSettings.php
@@ -54,13 +54,6 @@ class RegistrationSettings implements ISettings {
}
public function getForm(): TemplateResponse {
- // handle groups
- $groups = $this->groupManager->search('');
- $groupIds = [];
- foreach ($groups as $group) {
- $groupIds[] = $group->getGid();
- }
-
$this->initialState->provideInitialState(
'registered_user_group',
$this->getGroupDetailArray($this->config->getAppValue($this->appName, 'registered_user_group', 'none'))
@@ -87,15 +80,35 @@ class RegistrationSettings implements ISettings {
'disable_email_verification',
$this->config->getAppValue($this->appName, 'disable_email_verification', 'no') === 'yes'
);
+
$this->initialState->provideInitialState(
'email_is_login',
$this->config->getAppValue($this->appName, 'email_is_login', 'no') === 'yes'
);
-
$this->initialState->provideInitialState(
'username_policy_regex',
$this->config->getAppValue($this->appName, 'username_policy_regex')
);
+ $this->initialState->provideInitialState(
+ 'username_policy_regex',
+ $this->config->getAppValue($this->appName, 'username_policy_regex')
+ );
+ $this->initialState->provideInitialState(
+ 'show_fullname',
+ $this->config->getAppValue($this->appName, 'show_fullname', 'no') === 'yes'
+ );
+ $this->initialState->provideInitialState(
+ 'enforce_fullname',
+ $this->config->getAppValue($this->appName, 'enforce_fullname', 'no') === 'yes'
+ );
+ $this->initialState->provideInitialState(
+ 'show_phone',
+ $this->config->getAppValue($this->appName, 'show_phone', 'no') === 'yes'
+ );
+ $this->initialState->provideInitialState(
+ 'enforce_phone',
+ $this->config->getAppValue($this->appName, 'enforce_phone', 'no') === 'yes'
+ );
$this->initialState->provideInitialState(
'additional_hint',
diff --git a/src/AdminSettings.vue b/src/AdminSettings.vue
index 1bff2d5..69a8a38 100644
--- a/src/AdminSettings.vue
+++ b/src/AdminSettings.vue
@@ -39,35 +39,39 @@
+
+ + +
+
-
+ + +
+ {{ t('registration', 'If configured, login names will be validated through the regular expression. If the validation fails the user is prompted with a generic error. Make sure your regex is working correctly.') }} + -- + @change="saveData"> + +
+ ++ + +
+ ++ + +
+ ++ +
- {{ t('registration', 'If configured, login names will be validated through the regular expression. If the validation fails the user is prompted with a generic error. Make sure your regex is working correctly.') }}