Merge pull request #48 from rzeldent:bugfix/handle_401

Add handling for unauthorized
This commit is contained in:
rzeldent
2023-03-19 13:54:55 +01:00
committed by GitHub

View File

@@ -169,7 +169,7 @@ void handle_restart()
if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer)) if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer))
{ {
web_server.requestAuthentication(); web_server.requestAuthentication(BASIC_AUTH, APP_TITLE, "401 Unauthorized<br><br>The password is incorrect.");
return; return;
} }
@@ -219,7 +219,7 @@ void handle_flash()
if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer)) if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer))
{ {
web_server.requestAuthentication(); web_server.requestAuthentication(BASIC_AUTH, APP_TITLE, "401 Unauthorized<br><br>The password is incorrect.");
return; return;
} }
@@ -401,7 +401,7 @@ void setup()
{ iotWebConf.handleConfig(); }); { iotWebConf.handleConfig(); });
web_server.on("/restart", HTTP_GET, handle_restart); web_server.on("/restart", HTTP_GET, handle_restart);
// Camera snapshot // Camera snapshot
web_server.on("/snapshot", handle_snapshot); web_server.on("/snapshot", HTTP_GET, handle_snapshot);
// Camera flash light // Camera flash light
web_server.on("/flash", HTTP_GET, handle_flash); web_server.on("/flash", HTTP_GET, handle_flash);