Development
This commit is contained in:
parent
6c3abca58c
commit
96f6e32c8f
9 changed files with 294 additions and 166 deletions
|
|
@ -105,6 +105,13 @@ def blocklists_edit():
|
|||
return redirect(f'/{_PAGE}')
|
||||
|
||||
before = copy.deepcopy(items[idx])
|
||||
|
||||
# Blocklist name must be unique - it is the lookup key for VLAN use_blocklists references
|
||||
err = validate.check_blocklist_name_unique(items, fields['name'], exclude_idx=idx)
|
||||
if err:
|
||||
flash(err, 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
||||
items[idx].update({
|
||||
'name': fields['name'],
|
||||
'description': fields['description'],
|
||||
|
|
@ -134,8 +141,10 @@ def addblocklist_add():
|
|||
cfg = load_config()
|
||||
blocklists = cfg.setdefault('dns_blocking', {}).setdefault('blocklists', [])
|
||||
|
||||
if any(b.get('name', '').lower() == fields['name'].lower() for b in blocklists):
|
||||
flash('The configuration has not been saved because a blocklist with that name already exists.', 'error')
|
||||
# Blocklist name must be unique - it is the lookup key for VLAN use_blocklists references
|
||||
err = validate.check_blocklist_name_unique(blocklists, fields['name'])
|
||||
if err:
|
||||
flash(err, 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
||||
entry = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue