Development
This commit is contained in:
parent
d0cfffac52
commit
adcfe55c7c
24 changed files with 405 additions and 359 deletions
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
from flask import Blueprint, request, redirect, flash
|
||||
from auth import require_level
|
||||
from config_utils import load_core, save_core, verify_core_hash, queued_msg, queue_command
|
||||
from config_utils import load_config, save_config, verify_config_hash, queued_msg, queue_command
|
||||
import sanitize
|
||||
import validation as validate
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ def networkinterfaces_cardnetworkinterface_save():
|
|||
flash('WAN and LAN interfaces must be different.', 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
if not verify_core_hash(request.form.get('config_hash', '')):
|
||||
if not verify_config_hash(request.form.get('config_hash', '')):
|
||||
flash('Configuration was modified by another session. Please refresh and try again.', 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
|
|
@ -54,16 +54,16 @@ def networkinterfaces_cardnetworkinterface_save():
|
|||
flash(f"Interface '{iface}' does not exist on this system.", 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
core = load_core()
|
||||
gen = core.setdefault('network_interfaces', {})
|
||||
cfg = load_config()
|
||||
gen = cfg.setdefault('network_interfaces', {})
|
||||
gen['wan_interface'] = wan
|
||||
gen['lan_interface'] = lan
|
||||
errors = validate.validate_config(core)
|
||||
errors = validate.validate_config(cfg)
|
||||
if errors:
|
||||
for msg in errors:
|
||||
flash(msg, 'error')
|
||||
return redirect(_VIEW)
|
||||
save_core(core)
|
||||
save_config(cfg)
|
||||
|
||||
flash(queued_msg('core apply'), 'success')
|
||||
return redirect(_VIEW)
|
||||
|
|
@ -72,7 +72,7 @@ def networkinterfaces_cardnetworkinterface_save():
|
|||
@bp.route('/action/networkinterfaces_cardinterfaceconfiguration_apply', methods=['POST'])
|
||||
@require_level('administrator')
|
||||
def networkinterfaces_cardinterfaceconfiguration_apply():
|
||||
if not verify_core_hash(request.form.get('config_hash', '')):
|
||||
if not verify_config_hash(request.form.get('config_hash', '')):
|
||||
flash('Configuration was modified by another session. Please refresh and try again.', 'error')
|
||||
return redirect(_VIEW)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue