Hide login name policy when email is used

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-03-31 14:01:39 +02:00
parent 8c0ffecb7b
commit 58712c82d0
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 11 additions and 2 deletions

View File

@ -20,4 +20,11 @@ $(document).ready(function() {
event.preventDefault();
}
});
$('#email_is_login').change(function(event) {
if (event.target.checked) {
$('.login-name-policy').addClass('hidden');
} else {
$('.login-name-policy').removeClass('hidden');
}
});
});

View File

@ -59,13 +59,15 @@ foreach ($_['groups'] as $group) {
<label for="email_is_login"><?php p($l->t('Force email as login name')); ?></label>
</p>
<h3><?php p($l->t('Username policy')); ?></h3>
<div class="login-name-policy <?php if ($_['email_is_login'] === 'yes') { p('hidden'); } ?>">
<h3><?php p($l->t('Login name policy')); ?></h3>
<p>
<label>
<input type="text" id="username_policy_regex" name="username_policy_regex" value="<?php p($_['username_policy_regex']);?>" placeholder="E.g.: /^[a-z-]+\.[a-z-]+$/">
</label>
</p>
<em><?php p($l->t('If configured, usernames 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.'));?></em>
<em><?php p($l->t('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.'));?></em>
</div>
<h3><?php p($l->t('User instructions')); ?></h3>
<em><?php p($l->t('Caution: The user instructions will not be translated and will therefore be displayed as configured below for all users regardless of their actual language.'));?></em>