Skip to content

Commit 6d3e1a0

Browse files
authored
Merge pull request #48 from rzeldent:bugfix/handle_401
Add handling for unauthorized
2 parents 6a45d99 + 261bca8 commit 6d3e1a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void handle_restart()
169169

170170
if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer))
171171
{
172-
web_server.requestAuthentication();
172+
web_server.requestAuthentication(BASIC_AUTH, APP_TITLE, "401 Unauthorized<br><br>The password is incorrect.");
173173
return;
174174
}
175175

@@ -219,7 +219,7 @@ void handle_flash()
219219

220220
if (!web_server.authenticate("admin", iotWebConf.getApPasswordParameter()->valueBuffer))
221221
{
222-
web_server.requestAuthentication();
222+
web_server.requestAuthentication(BASIC_AUTH, APP_TITLE, "401 Unauthorized<br><br>The password is incorrect.");
223223
return;
224224
}
225225

@@ -401,7 +401,7 @@ void setup()
401401
{ iotWebConf.handleConfig(); });
402402
web_server.on("/restart", HTTP_GET, handle_restart);
403403
// Camera snapshot
404-
web_server.on("/snapshot", handle_snapshot);
404+
web_server.on("/snapshot", HTTP_GET, handle_snapshot);
405405
// Camera flash light
406406
web_server.on("/flash", HTTP_GET, handle_flash);
407407

0 commit comments

Comments
 (0)