enable authentication

This commit is contained in:
Siwat Sirichai 2024-01-01 20:31:06 +07:00
parent daaabe5f26
commit cd271efddd
1 changed files with 2 additions and 0 deletions

View File

@ -106,6 +106,7 @@ void ESPMegaWebServer::setWebPassword(const char* password)
void ESPMegaWebServer::dashboardHandler(AsyncWebServerRequest *request) void ESPMegaWebServer::dashboardHandler(AsyncWebServerRequest *request)
{ {
request->authenticate(this->webUsername, this->webPassword);
auto bindedDashboardProcessor = std::bind(&ESPMegaWebServer::dashboardProcessor, this, std::placeholders::_1); auto bindedDashboardProcessor = std::bind(&ESPMegaWebServer::dashboardProcessor, this, std::placeholders::_1);
request->send_P(200, "text/html", ota_html, bindedDashboardProcessor); request->send_P(200, "text/html", ota_html, bindedDashboardProcessor);
} }
@ -150,6 +151,7 @@ String ESPMegaWebServer::dashboardProcessor(const String &var)
void ESPMegaWebServer::configHandler(AsyncWebServerRequest *request) void ESPMegaWebServer::configHandler(AsyncWebServerRequest *request)
{ {
request->authenticate(this->webUsername, this->webPassword);
auto bindedConfigProcessor = std::bind(&ESPMegaWebServer::configProcessor, this, std::placeholders::_1); auto bindedConfigProcessor = std::bind(&ESPMegaWebServer::configProcessor, this, std::placeholders::_1);
request->send_P(200, "text/html", config_html, bindedConfigProcessor); request->send_P(200, "text/html", config_html, bindedConfigProcessor);
} }