From 52dc829cb1c97f7883fa553b09f9b9c50119661a Mon Sep 17 00:00:00 2001 From: technyon Date: Thu, 14 Jul 2022 20:09:44 +0200 Subject: [PATCH] require to retype password --- WebCfgServer.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index a431b8f..164fa15 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -165,6 +165,10 @@ bool WebCfgServer::processArgs(String& message) bool clearCredentials = false; int count = _server.args(); + + String pass1 = ""; + String pass2 = ""; + for(int index = 0; index < count; index++) { String key = _server.argName(index); @@ -308,8 +312,11 @@ bool WebCfgServer::processArgs(String& message) } else if(key == "CREDPASS") { - _preferences->putString(preference_cred_password, value); - configChanged = true; + pass1 = value; + } + else if(key == "CREDPASSRE") + { + pass2 = value; } else if(key == "NUKIPIN" && _nuki != nullptr) { @@ -339,6 +346,12 @@ bool WebCfgServer::processArgs(String& message) } } + if(pass1 != "" && pass1 == pass2) + { + _preferences->putString(preference_cred_password, pass1); + configChanged = true; + } + if(clearMqttCredentials) { _preferences->putString(preference_mqtt_user, ""); @@ -428,7 +441,8 @@ void WebCfgServer::buildCredHtml(String &response) response.concat("

Credentials

"); response.concat(""); printInputField(response, "CREDUSER", "User (# to clear)", _preferences->getString(preference_cred_user).c_str(), 20); - printInputField(response, "CREDPASS", "Password", "*", 30, true); + printInputField(response, "CREDPASS", "Password (max 30 characters)", "*", 30, true); + printInputField(response, "CREDPASSRE", "Retype password", "*", 30, true); response.concat("
"); response.concat("
"); response.concat("");