Commit bb4348a7 authored by Eric Duminil's avatar Eric Duminil
Browse files

Show password with ***** in HTML form

Needs more testing
parent 02fdbd73
...@@ -400,7 +400,7 @@ String PasswordParameter::renderHtml( ...@@ -400,7 +400,7 @@ String PasswordParameter::renderHtml(
bool dataArrived, bool dataArrived,
bool hasValueFromPost, String valueFromPost) bool hasValueFromPost, String valueFromPost)
{ {
return TextParameter::renderHtml("password", true, String("")); return TextParameter::renderHtml("password", true, String(this->valueBuffer));
} }
void PasswordParameter::debugTo(Stream* out) void PasswordParameter::debugTo(Stream* out)
...@@ -425,7 +425,7 @@ void PasswordParameter::update(String newValue) ...@@ -425,7 +425,7 @@ void PasswordParameter::update(String newValue)
Serial.print(this->getId()); Serial.print(this->getId());
Serial.print(": "); Serial.print(": ");
#endif #endif
if (newValue.length() > 0) if (newValue != current->valueBuffer)
{ {
// -- Value was set. // -- Value was set.
newValue.toCharArray(current->valueBuffer, current->getLength()); newValue.toCharArray(current->valueBuffer, current->getLength());
......
...@@ -575,7 +575,7 @@ using CharArrayDataType<len>::CharArrayDataType; ...@@ -575,7 +575,7 @@ using CharArrayDataType<len>::CharArrayDataType;
Serial.print(this->getId()); Serial.print(this->getId());
Serial.print(": "); Serial.print(": ");
#endif #endif
if (newValue.length() > 0) if (newValue != this->_value)
{ {
// -- Value was set. // -- Value was set.
strncpy(this->_value, newValue.c_str(), len); strncpy(this->_value, newValue.c_str(), len);
...@@ -601,7 +601,7 @@ protected: ...@@ -601,7 +601,7 @@ protected:
virtual String renderHtml( virtual String renderHtml(
bool dataArrived, bool hasValueFromPost, String valueFromPost) override bool dataArrived, bool hasValueFromPost, String valueFromPost) override
{ {
return InputParameter::renderHtml(dataArrived, true, String("")); return InputParameter::renderHtml(dataArrived, true, String(this->_value));
} }
private: private:
const char* _customHtmlPwd = "ondblclick=\"pw(this.id)\""; const char* _customHtmlPwd = "ondblclick=\"pw(this.id)\"";
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "src/lib/IotWebConf/src/IotWebConfTParameter.h" #include "src/lib/IotWebConf/src/IotWebConfTParameter.h"
#include "src/lib/IotWebConf/src/IotWebConfOptionalGroup.h" #include "src/lib/IotWebConf/src/IotWebConfOptionalGroup.h"
//TODO: Check memory consumption. Disable DEBUG info?
//TODO: Convert all strings to F-strings //TODO: Convert all strings to F-strings
namespace web_config { namespace web_config {
...@@ -114,7 +113,6 @@ namespace web_config { ...@@ -114,7 +113,6 @@ namespace web_config {
TextTParameter<STRING_LEN> mqttUserParam = TextTParameter<STRING_LEN> mqttUserParam =
Builder<TextTParameter<STRING_LEN>>("mqtt_user").label("MQTT User").defaultValue(MQTT_USER).build(); Builder<TextTParameter<STRING_LEN>>("mqtt_user").label("MQTT User").defaultValue(MQTT_USER).build();
//TODO: Show the number of * for password?
PasswordTParameter<STRING_LEN> mqttPasswordParam = Builder<PasswordTParameter<STRING_LEN>>("mqtt_password").label( PasswordTParameter<STRING_LEN> mqttPasswordParam = Builder<PasswordTParameter<STRING_LEN>>("mqtt_password").label(
"MQTT password").defaultValue(MQTT_PASSWORD).build(); "MQTT password").defaultValue(MQTT_PASSWORD).build();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment