diff --git a/src/Config.h b/src/Config.h
index fd8bfc4..75661ba 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -4,7 +4,7 @@
#define NUKI_HUB_VERSION "9.02"
#define NUKI_HUB_BUILD "unknownbuildnr"
-#define NUKI_HUB_DATE "2024-10-18"
+#define NUKI_HUB_DATE "2024-10-19"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
diff --git a/src/WebCfgServer.cpp b/src/WebCfgServer.cpp
index ed4d76a..7aed68c 100644
--- a/src/WebCfgServer.cpp
+++ b/src/WebCfgServer.cpp
@@ -104,7 +104,23 @@ void WebCfgServer::initialize()
});
_psychicServer->on("/reboot", HTTP_GET, [&](PsychicRequest *request){
if(strlen(_credUser) > 0 && strlen(_credPassword) > 0) if(!request->authenticate(_credUser, _credPassword)) return request->requestAuthentication(BASIC_AUTH, "Nuki Hub", "You must log in.");
- esp_err_t res = buildConfirmHtml(request, "Rebooting", 2, true);
+
+ String value = "";
+ if(request->hasParam("CONFIRMTOKEN"))
+ {
+ const PsychicWebParameter* p = request->getParam("CONFIRMTOKEN");
+ if(p->value() != "") value = p->value();
+ }
+ else
+ {
+ return buildConfirmHtml(request, "No confirm code set.", 3, true);
+ }
+
+ if(value != _confirmCode)
+ {
+ return request->redirect("/");
+ }
+ esp_err_t res = buildConfirmHtml(request, "Rebooting...", 2, true);
waitAndProcess(true, 1000);
restartEsp(RestartReason::RequestedViaWebServer);
return res;
@@ -251,7 +267,22 @@ void WebCfgServer::initialize()
});
_psychicServer->on("/reboottoota", HTTP_GET, [&](PsychicRequest *request){
if(strlen(_credUser) > 0 && strlen(_credPassword) > 0) if(!request->authenticate(_credUser, _credPassword)) return request->requestAuthentication(BASIC_AUTH, "Nuki Hub", "You must log in.");
- esp_err_t res = buildConfirmHtml(request, "Rebooting to other partition", 2, true);
+ String value = "";
+ if(request->hasParam("CONFIRMTOKEN"))
+ {
+ const PsychicWebParameter* p = request->getParam("CONFIRMTOKEN");
+ if(p->value() != "") value = p->value();
+ }
+ else
+ {
+ return buildConfirmHtml(request, "No confirm code set.", 3, true);
+ }
+
+ if(value != _confirmCode)
+ {
+ return request->redirect("/");
+ }
+ esp_err_t res = buildConfirmHtml(request, "Rebooting to other partition...", 2, true);
waitAndProcess(true, 1000);
esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL));
restartEsp(RestartReason::OTAReboot);
@@ -409,7 +440,9 @@ esp_err_t WebCfgServer::buildWifiConnectHtml(PsychicRequest *request)
response.print("");
response.print("
");
response.print("");
- response.print("