From 39e7a31bfcc47a2df308fb855d27b00216f6d061 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Tue, 15 Feb 2022 10:59:40 +0100
Subject: [PATCH] AMPEL_PASSWORD instead of HTTP_PASSWORD

---
 ampel-firmware/config.public.h | 14 +++++++++-----
 ampel-firmware/web_config.cpp  |  6 +-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ampel-firmware/config.public.h b/ampel-firmware/config.public.h
index 4333280..501dced 100644
--- a/ampel-firmware/config.public.h
+++ b/ampel-firmware/config.public.h
@@ -2,6 +2,9 @@
 #  define CONFIG_H_INCLUDED
 
 // This file is a config template, and can be copied to config.h. Please don't save any important password in this template.
+// NOTE: Every parameter can be modified and saved later via the web-config.
+// Some of those parameters can also be modified via commands in the Serial monitor :
+//    e.g. 'wifi 0' to turn WiFi off, or 'csv 60' to log data in csv every minute.
 
 /**
  * SERVICES
@@ -68,13 +71,14 @@
 #  define LED_COUNT 12
 
 /**
- * WEB SERVER
- * available at http://local_ip, with user HTTP_USER and password HTTP_PASSWORD
+ * AMPEL PASSWORD
+ * will be used for Access Point (without username), and for web-server available at http://local_ip
+ * with user 'admin', without quotes.
  */
 
-// Define empty strings in order to disable authentication, or remove the constants altogether.
-#  define HTTP_USER "co2ampel"
-#  define HTTP_PASSWORD "my_password"
+// If left empty, the password will be set during the first configuration, via access point.
+// In order to be set successfully, it should have at least 8 characters.
+#  define AMPEL_PASSWORD ""
 
 /**
  * MQTT
diff --git a/ampel-firmware/web_config.cpp b/ampel-firmware/web_config.cpp
index d646e42..78a894e 100644
--- a/ampel-firmware/web_config.cpp
+++ b/ampel-firmware/web_config.cpp
@@ -179,7 +179,7 @@ namespace web_config {
   }
 
   void initialize() {
-    iotWebConf = new IotWebConf(ampel.sensorId, &dnsServer, &http, HTTP_PASSWORD, config_version);
+    iotWebConf = new IotWebConf(ampel.sensorId, &dnsServer, &http, AMPEL_PASSWORD, config_version);
 
     iotWebConf->setHtmlFormatProvider(&optionalGroupHtmlFormatProvider);
 
@@ -340,10 +340,6 @@ namespace config {
   bool &mqtt_encryption = web_config::mqttEncryptionParam.value();
   bool &allow_mqtt_commands = web_config::mqttCommandsParam.value();
 
-// HTTP
-//  const char *http_user = IOTWEBCONF_ADMIN_USER_NAME; // "admin" by default
-//  char *http_password = web_config::iotWebConf->getApPasswordParameter()->valueBuffer;
-
 // LORAWAN
 #if defined(ESP32)
   bool is_lorawan_active() {
-- 
GitLab