Development
This commit is contained in:
parent
55ae07160d
commit
f237c69307
3 changed files with 28 additions and 0 deletions
|
|
@ -118,6 +118,14 @@ def networklayout_tablevlans_edit():
|
|||
request.form.getlist('use_blocklists'),
|
||||
{b.get('name') for b in load_config().get('dns_blocking', {}).get('blocklists', [])},
|
||||
)
|
||||
identity_ips_raw = [line.strip() for line in request.form.get('server_identity_ips', '').splitlines() if line.strip()]
|
||||
identity_ips = []
|
||||
for raw_ip in identity_ips_raw:
|
||||
clean = sanitize.ip(raw_ip)
|
||||
if not clean:
|
||||
flash(f"'{raw_ip}' is not a valid IP address.", 'error')
|
||||
return redirect(VIEW)
|
||||
identity_ips.append(clean)
|
||||
|
||||
subnet_mask_raw = request.form.get('subnet_mask')
|
||||
if subnet_mask_raw is not None:
|
||||
|
|
@ -168,6 +176,13 @@ def networklayout_tablevlans_edit():
|
|||
flash('Only one VLAN can be the RADIUS default.', 'error')
|
||||
return redirect(VIEW)
|
||||
|
||||
old_identities = existing.get('server_identities', [])
|
||||
new_identities = []
|
||||
for i, ip in enumerate(identity_ips):
|
||||
entry = dict(old_identities[i]) if i < len(old_identities) else {}
|
||||
entry['ip'] = ip
|
||||
new_identities.append(entry)
|
||||
|
||||
before = {k: existing.get(k) for k in _VLAN_FIELDS}
|
||||
existing.update({
|
||||
'name': name,
|
||||
|
|
@ -178,6 +193,7 @@ def networklayout_tablevlans_edit():
|
|||
'radius_default': radius_default,
|
||||
'mdns_reflection': mdns_reflection,
|
||||
'use_blocklists': use_blocklists,
|
||||
'server_identities': new_identities,
|
||||
})
|
||||
errors = validate.validate_config(cfg)
|
||||
if errors:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue