#936 user auth method should be drop-down

This commit is contained in:
Oliver Gorwits
2022-10-18 11:50:12 +01:00
parent ab8c371524
commit 2a35a0bc56
3 changed files with 42 additions and 20 deletions

View File

@@ -40,9 +40,17 @@ ajax '/ajax/control/admin/users/add' => require_role setting('defanged_admin') =
username => param('username'),
password => _make_password(param('password')),
fullname => param('fullname'),
ldap => (param('ldap') ? \'true' : \'false'),
radius => (param('radius') ? \'true' : \'false'),
tacacs => (param('tacacs') ? \'true' : \'false'),
(param('auth_method') ? (
(ldap => (param('auth_method') eq 'ldap' ? \'true' : \'false')),
(radius => (param('auth_method') eq 'radius' ? \'true' : \'false')),
(tacacs => (param('auth_method') eq 'tacacs' ? \'true' : \'false')),
) : (
ldap => \'false',
radius => \'false',
tacacs => \'false',
)),
port_control => (param('port_control') ? \'true' : \'false'),
admin => (param('admin') ? \'true' : \'false'),
note => param('note'),
@@ -72,9 +80,17 @@ ajax '/ajax/control/admin/users/update' => require_role setting('defanged_admin'
? (password => _make_password(param('password')))
: ()),
fullname => param('fullname'),
ldap => (param('ldap') ? \'true' : \'false'),
radius => (param('radius') ? \'true' : \'false'),
tacacs => (param('tacacs') ? \'true' : \'false'),
(param('auth_method') ? (
(ldap => (param('auth_method') eq 'ldap' ? \'true' : \'false')),
(radius => (param('auth_method') eq 'radius' ? \'true' : \'false')),
(tacacs => (param('auth_method') eq 'tacacs' ? \'true' : \'false')),
) : (
ldap => \'false',
radius => \'false',
tacacs => \'false',
)),
port_control => (param('port_control') ? \'true' : \'false'),
admin => (param('admin') ? \'true' : \'false'),
note => param('note'),

View File

@@ -4,9 +4,7 @@
<th class="nd_center-cell">Full Name</th>
<th class="nd_center-cell">Username</th>
<th class="nd_center-cell">Password</th>
<th class="nd_center-cell">LDAP Auth</th>
<th class="nd_center-cell">RADIUS Auth</th>
<th class="nd_center-cell">TACACS+ Auth</th>
<th class="nd_center-cell">Auth Method</th>
<th class="nd_center-cell">Port Control</th>
<th class="nd_center-cell">Administrator</th>
<th class="nd_center-cell">Created</th>
@@ -20,9 +18,16 @@
<td class="nd_center-cell"><input data-form="add" name="fullname" type="text"></td>
<td class="nd_center-cell"><input class="span2" data-form="add" name="username" type="text"></td>
<td class="nd_center-cell"><input class="span2" data-form="add" name="password" type="password"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="ldap"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="radius"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="tacacs"></td>
<td class="nd_center-cell">
<div class="form-group">
<select class="span2 form-control" data-form="add" name="auth_method">
<option value="" selected>Netdisco Password</option>
<option value="ldap">LDAP</option>
<option value="radius">RADIUS</option>
<option value="tacacs">TACACS</option>
</select>
</div>
</td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="port_control"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="admin"></td>
<td class="nd_center-cell"></td>
@@ -47,13 +52,14 @@
<input class="span2" data-form="update" name="password" type="password" value="********">
</td>
<td class="nd_center-cell">
<input data-form="update" name="ldap" type="checkbox" [% ' checked="checked"' IF row.ldap %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="radius" type="checkbox" [% ' checked="checked"' IF row.radius %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="tacacs" type="checkbox" [% ' checked="checked"' IF row.tacacs %]>
<div class="form-group">
<select class="span2 form-control" data-form="update" name="auth_method">
<option value="">Netdisco Password</option>
<option[% ' selected' IF row.ldap %] value="ldap">LDAP</option>
<option[% ' selected' IF row.radius %] value="radius">RADIUS</option>
<option[% ' selected' IF row.tacacs %] value="tacacs">TACACS</option>
</select>
</div>
</td>
<td class="nd_center-cell">
<input data-form="update" name="port_control" type="checkbox" [% ' checked="checked"' IF row.port_control %]>

View File

@@ -141,7 +141,7 @@
,async: true
,dataType: 'html'
,url: uri_base + '/ajax/control/admin/' + tab + '/' + mode
,data: $(this).closest('tr').find('input[data-form="' + mode + '"]').serializeArray()
,data: $(this).closest('tr').find('input[data-form="' + mode + '"],select[data-form="' + mode + '"]').serializeArray()
,beforeSend: function() {
if (mode == 'add' || mode == 'delete') {
$(target).html(