From a8e3beb14b5acddeda243181b407baa6b839bbfa Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 24 Feb 2015 21:50:22 +0200 Subject: [PATCH] admin password change now triggers a reboot (if reboot enabled) --- src/handlers.py | 5 +++-- src/wifictl.py | 17 +++++++++++------ templates/main.html | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/handlers.py b/src/handlers.py index 9d617b4..767c6aa 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -295,6 +295,7 @@ class ConfigHandler(BaseHandler): additional_configs = config.get_additional_structure(camera=False)[1] reboot_config_names = [('@_' + c['name']) for c in additional_configs.values() if c.get('reboot')] + reboot_config_names.append('@admin_password') reboot = bool([k for k in reboot_config_names if old_main_config.get(k) != main_config.get(k)]) config.set_main(main_config) @@ -305,8 +306,8 @@ class ConfigHandler(BaseHandler): logging.debug('admin credentials changed, reload needed') reload = True - - if reboot: + + if reboot and settings.ENABLE_REBOOT: logging.debug('system settings changed, reboot needed') reboot = True diff --git a/src/wifictl.py b/src/wifictl.py index dd7dd9f..ad3f8e6 100644 --- a/src/wifictl.py +++ b/src/wifictl.py @@ -72,14 +72,20 @@ def _get_wifi_settings(): if ssid: logging.debug('wifi is enabled (ssid = "%s")' % ssid) + return { + 'wifiEnabled': True, + 'wifiNetworkName': ssid, + 'wifiNetworkKey': psk + } + else: logging.debug('wifi is disabled') - return { - 'wifiEnabled': False, - 'wifiNetworkName': ssid, - 'wifiNetworkKey': psk - } + return { + 'wifiEnabled': False, + 'wifiNetworkName': ssid, + 'wifiNetworkKey': psk + } def _set_wifi_settings(s): @@ -180,7 +186,6 @@ def network(): } - @additional_config def wifiEnabled(): if not WPA_SUPPLICANT_CONF: diff --git a/templates/main.html b/templates/main.html index b711918..75466b5 100644 --- a/templates/main.html +++ b/templates/main.html @@ -108,7 +108,7 @@ ? - + Administrator Password ? -- 2.39.5