From 48e947287ac9c598c745530955da4326d549779e Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Sun, 27 Nov 2022 16:59:28 -0500 Subject: [PATCH 1/2] Added variant of the text type to support hidden password fields --- src/ESPUIcontrol.cpp | 7 ++++--- src/ESPUIcontrol.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ESPUIcontrol.cpp b/src/ESPUIcontrol.cpp index e9c973c..f276c68 100644 --- a/src/ESPUIcontrol.cpp +++ b/src/ESPUIcontrol.cpp @@ -59,16 +59,17 @@ void Control::DeleteControl() void Control::MarshalControl(JsonObject & item, bool refresh) { item[F("id")] = id; + ControlType TempType = (ControlType::Password == type) ? ControlType::Text : type; if(refresh) { - item[F("type")] = uint32_t(type) + uint32_t(ControlType::UpdateOffset); + item[F("type")] = uint32_t(TempType) + uint32_t(ControlType::UpdateOffset); } else { - item[F("type")] = uint32_t(type); + item[F("type")] = uint32_t(TempType); } item[F("label")] = label; - item[F("value")] = value; + item[F ("value")] = (ControlType::Password == type) ? F ("--------") : value; item[F("visible")] = visible; item[F("color")] = (int)color; item[F("enabled")] = enabled; diff --git a/src/ESPUIcontrol.h b/src/ESPUIcontrol.h index 144904c..d47c074 100644 --- a/src/ESPUIcontrol.h +++ b/src/ESPUIcontrol.h @@ -30,6 +30,7 @@ enum ControlType : uint8_t Separator, Time, + Password = 99, UpdateOffset = 100, }; From be8cf73d550ac534f12407082ca986f0a21c8998 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 12 May 2023 15:02:32 -0400 Subject: [PATCH 2/2] Exposed WebServer instance --- src/ESPUI.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ESPUI.h b/src/ESPUI.h index b68c74d..fb42039 100644 --- a/src/ESPUI.h +++ b/src/ESPUI.h @@ -206,6 +206,7 @@ public: void jsonDom(uint16_t startidx, AsyncWebSocketClient* client = nullptr, bool Updating = false); Verbosity verbosity; + AsyncWebServer* server; protected: friend class ESPUIclient; @@ -217,7 +218,6 @@ protected: void RemoveToBeDeletedControls(); - AsyncWebServer* server; AsyncWebSocket* ws; const char* basicAuthUsername = nullptr;