User management: add user OTP seed option in System->Settings->Administration. for https://github.com/opnsense/core/issues/4474

This commit is contained in:
Ad Schellevis 2020-11-23 18:37:35 +01:00
parent 323cbfd81d
commit f73aa36ce3

View File

@ -56,6 +56,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['disableintegratedauth'] = !empty($config['system']['disableintegratedauth']);
$pconfig['sudo_allow_wheel'] = $config['system']['sudo_allow_wheel'];
$pconfig['sudo_allow_group'] = isset($config['system']['sudo_allow_group']) ? $config['system']['sudo_allow_group'] : null;
$pconfig['user_allow_gen_token'] = isset($config['system']['user_allow_gen_token']) ? explode(",", $config['system']['user_allow_gen_token']) : null;
$pconfig['nodnsrebindcheck'] = isset($config['system']['webgui']['nodnsrebindcheck']);
$pconfig['nohttpreferercheck'] = isset($config['system']['webgui']['nohttpreferercheck']);
$pconfig['althostnames'] = $config['system']['webgui']['althostnames'];
@ -264,6 +265,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['sudo_allow_group']);
}
if (!empty($pconfig['user_allow_gen_token'])) {
$config['system']['user_allow_gen_token'] = implode(",", $pconfig['user_allow_gen_token']);
} elseif (isset($config['system']['user_allow_gen_token'])) {
unset($config['system']['user_allow_gen_token']);
}
if (!empty($pconfig['sshpasswordauth'])) {
$config['system']['ssh']['passwordauth'] = true;
} elseif (isset($config['system']['ssh']['passwordauth'])) {
@ -928,6 +936,24 @@ $(document).ready(function() {
</div>
</td>
</tr>
<tr>
<td><a id="help_for_user_allow_gen_token" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('User OTP seed') ?></td>
<td>
<select name="user_allow_gen_token[]" multiple=multiple class="selectpicker">
<?php foreach ($a_group as $group): ?>
<option value="<?= html_safe($group['name']) ?>" <?= in_array($group['name'], $pconfig['user_allow_gen_token']) ? 'selected="selected"' : '' ?>>
<?= html_safe($group['name']) ?>
</option>
<?php endforeach ?>
</select>
<div class="hidden" data-for="help_for_user_allow_gen_token">
<?= gettext('Permit users to generate their own OTP seed in the password page.') ?>
</div>
</td>
</tr>
</table>
</div>
<div class="content-box tab-content table-responsive">