Add admin UI option for "Force email as user id"
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
69197003a2
commit
a9246921f0
|
|
@ -7,3 +7,7 @@ select {
|
|||
h3 {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class RegisterController extends Controller {
|
|||
|
||||
return new TemplateResponse('registration', 'form/user', [
|
||||
'email' => $registration->getEmail(),
|
||||
'email_is_login' => $this->config->getAppValue('registration', 'email_is_login', '0') === '1',
|
||||
'email_is_login' => $this->config->getAppValue('registration', 'email_is_login', 'no') === 'yes',
|
||||
'username' => $username,
|
||||
'message' => $message,
|
||||
], 'guest');
|
||||
|
|
@ -218,7 +218,7 @@ class RegisterController extends Controller {
|
|||
return $this->validateSecretAndTokenErrorPage();
|
||||
}
|
||||
|
||||
if ($this->config->getAppValue('registration', 'email_is_login', '0') === '1') {
|
||||
if ($this->config->getAppValue('registration', 'email_is_login', 'no') === 'yes') {
|
||||
$username = $registration->getEmail();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,10 +44,11 @@ class SettingsController extends Controller {
|
|||
*
|
||||
* @param string $registered_user_group all newly registered user will be put in this group
|
||||
* @param string $allowed_domains Registrations are only allowed for E-Mailadresses with these domains
|
||||
* @param bool $admin_approval_required newly registered users have to be validated by an admin
|
||||
* @param bool|null $admin_approval_required newly registered users have to be validated by an admin
|
||||
* @param bool|null $email_is_login email address is forced as user id
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function admin($registered_user_group, $allowed_domains, $admin_approval_required) {
|
||||
public function admin(string $registered_user_group, string $allowed_domains, ?bool $admin_approval_required, ?bool $email_is_login) {
|
||||
// handle domains
|
||||
if (($allowed_domains === '') || ($allowed_domains === null)) {
|
||||
$this->config->deleteAppValue($this->appName, 'allowed_domains');
|
||||
|
|
@ -56,7 +57,10 @@ class SettingsController extends Controller {
|
|||
}
|
||||
|
||||
// handle admin validation
|
||||
$this->config->setAppValue($this->appName, 'admin_approval_required', $admin_approval_required ? "yes" : "no");
|
||||
$this->config->setAppValue($this->appName, 'admin_approval_required', $admin_approval_required ? 'yes' : 'no');
|
||||
|
||||
// handle email is login
|
||||
$this->config->setAppValue($this->appName, 'email_is_login', $email_is_login ? 'yes' : 'no');
|
||||
|
||||
// handle groups
|
||||
$groups = $this->groupmanager->search('');
|
||||
|
|
|
|||
|
|
@ -60,13 +60,17 @@ class RegistrationSettings implements ISettings {
|
|||
$allowedDomains = $this->config->getAppValue($this->appName, 'allowed_domains', '');
|
||||
|
||||
// handle admin validation
|
||||
$adminApprovalRequired = $this->config->getAppValue($this->appName, 'admin_approval_required', "no");
|
||||
$adminApprovalRequired = $this->config->getAppValue($this->appName, 'admin_approval_required', 'no');
|
||||
|
||||
// handle admin validation
|
||||
$emailIsLogin = $this->config->getAppValue($this->appName, 'email_is_login', 'no');
|
||||
|
||||
return new TemplateResponse('registration', 'admin', [
|
||||
'groups' => $groupIds,
|
||||
'current' => $assignedGroups,
|
||||
'allowed' => $allowedDomains,
|
||||
'approval_required' => $adminApprovalRequired
|
||||
'approval_required' => $adminApprovalRequired,
|
||||
'email_is_login' => $emailIsLogin,
|
||||
], '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,19 @@ foreach ($_['groups'] as $group) {
|
|||
<input type="text" id="allowed_domains" name="allowed_domains" value="<?php p($_['allowed']);?>" placeholder="nextcloud.com;*.example.com">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<em><?php p($l->t('Enter a semicolon-separated list of allowed domains, * for wildcard. Example: %s', ['nextcloud.com;*.example.com']));?></em>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" id="email_is_login" class="checkbox" name="email_is_login" <?php if ($_['email_is_login'] === 'yes') {
|
||||
echo ' checked';
|
||||
} ?>>
|
||||
<label for="email_is_login"><?php p($l->t('Force email as login name')); ?></label>
|
||||
</p>
|
||||
|
||||
<h3><?php p($l->t('Admin approval')); ?></h3>
|
||||
<p>
|
||||
<input type="checkbox" id="admin_approval_required" class="checkbox" name="admin_approval_required" <?php if ($_['approval_required'] === "yes") {
|
||||
echo " checked";
|
||||
<input type="checkbox" id="admin_approval_required" class="checkbox" name="admin_approval_required" <?php if ($_['approval_required'] === 'yes') {
|
||||
echo ' checked';
|
||||
} ?>>
|
||||
<label for="admin_approval_required"><?php p($l->t('Require admin approval')); ?></label>
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue