From a4a58c0117fef604ee94c2ce813d28f799753171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 10 Feb 2017 14:27:46 +0100 Subject: [PATCH] Option to disable password change when using default password --- code/espurna/config/general.h | 1 + code/espurna/web.ino | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 65d02b48..210ba2bb 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -78,6 +78,7 @@ #define WIFI_RECONNECT_INTERVAL 300000 #define WIFI_MAX_NETWORKS 5 #define ADMIN_PASS "fibonacci" +#define FORCE_CHANGE_PASS 1 #define HTTP_USERNAME "admin" #define WS_BUFFER_SIZE 5 #define WS_TIMEOUT 1800000 diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 543eee2e..cda52e17 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -647,13 +647,16 @@ void _onHome(AsyncWebServerRequest *request) { if (!_authenticate(request)) return request->requestAuthentication(); - String password = getSetting("adminPass", ADMIN_PASS); - if (password.equals(ADMIN_PASS)) { - request->send(SPIFFS, "/password.html"); - } else { + #if FORCE_CHANGE_PASS == 1 + String password = getSetting("adminPass", ADMIN_PASS); + if (password.equals(ADMIN_PASS)) { + request->send(SPIFFS, "/password.html"); + } else { + request->send(SPIFFS, "/index.html"); + } + #else request->send(SPIFFS, "/index.html"); - } - + #endif } void _onAuth(AsyncWebServerRequest *request) {