add button to restart to wifi configuration

This commit is contained in:
technyon
2022-04-08 22:31:51 +02:00
parent 4303b0d877
commit 17461a2a84
6 changed files with 99 additions and 2 deletions

View File

@@ -152,6 +152,13 @@ bool WebCfgServer::processArgs()
_preferences->putString(preference_cred_password, value);
configChanged = true;
}
else if(key == "WIFICONF")
{
if(value == _preferences->getString(preference_cred_password))
{
_network->restartAndConfigureWifi();
}
}
}
if(clearMqttCredentials)
@@ -234,6 +241,17 @@ void WebCfgServer::buildHtml(String& response)
response.concat("<button type=\"submit\">Edit</button>");
response.concat("</form>");
response.concat("<FORM ACTION=method=get >");
response.concat("<BR><BR><h3>Wifi</h3>");
response.concat("<table>");
printInputField(response, "WIFICONF", "Type password to confirm", "", 20, true);
response.concat("</table>");
response.concat("<br><INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Restart and configure WiFi\">");
response.concat("</FORM><BR><BR>");
response.concat("</BODY>\n");
response.concat("</HTML>\n");
}