Fix Wifi reconfigure

This commit is contained in:
iranl
2024-11-22 21:33:04 +01:00
parent 9ecd21a8ee
commit a991b893b5
2 changed files with 4 additions and 16 deletions

View File

@@ -4041,10 +4041,11 @@ esp_err_t WebCfgServer::buildConfigureWifiHtml(PsychicRequest *request)
PsychicStreamResponse response(request, "text/plain");
response.beginSend();
buildHtmlHeader(&response);
response.print("<form method=\"get\" action=\"wifimanager\">");
response.print("<h3>Wi-Fi</h3>");
response.print("Click confirm to remove saved WiFi settings and restart ESP into Wi-Fi configuration mode. After restart, connect to ESP access point to reconfigure Wi-Fi.<br><br>");
String wifiMgrUrl = "/wifimanager?CONFIRMTOKEN=" + _confirmCode;
buildNavigationButton(&response, "Confirm", wifiMgrUrl.c_str());
response.print("Click confirm to remove saved WiFi settings and restart ESP into Wi-Fi configuration mode. After restart, connect to ESP access point to reconfigure Wi-Fi.<br><br><br>");
response.print("<input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><input type=\"submit\" value=\"Reboot\" /></form>");
response.print("</form>");
response.print("</body></html>");
return response.endSend();
}
@@ -4896,18 +4897,6 @@ void WebCfgServer::printDropDown(PsychicStreamResponse *response, const char *to
response->print("</td></tr>");
}
void WebCfgServer::buildNavigationButton(PsychicStreamResponse *response, const char *caption, const char *targetPath, const char* labelText)
{
response->print("<form method=\"get\" action=\"");
response->print(targetPath);
response->print("\">");
response->print("<button type=\"submit\">");
response->print(caption);
response->print("</button> ");
response->print(labelText);
response->print("</form>");
}
void WebCfgServer::buildNavigationMenuEntry(PsychicStreamResponse *response, const char *title, const char *targetPath, const char* warningMessage)
{
response->print("<a href=\"");

View File

@@ -72,7 +72,6 @@ private:
esp_err_t processFactoryReset(PsychicRequest *request);
void printTextarea(PsychicStreamResponse *response, const char *token, const char *description, const char *value, const size_t& maxLength, const bool& enabled = true, const bool& showLengthRestriction = false);
void printDropDown(PsychicStreamResponse *response, const char *token, const char *description, const String preselectedValue, std::vector<std::pair<String, String>> options, const String className);
void buildNavigationButton(PsychicStreamResponse *response, const char* caption, const char* targetPath, const char* labelText = "");
void buildNavigationMenuEntry(PsychicStreamResponse *response, const char *title, const char *targetPath, const char* warningMessage = "");
const std::vector<std::pair<String, String>> getNetworkDetectionOptions() const;