@@ -8,18 +8,18 @@ const char* password = "........";
8
8
ESP8266WebServer server (80 );
9
9
10
10
// Check if header is present and correct
11
- bool is_authentified () {
12
- Serial.println (" Enter is_authentified " );
11
+ bool is_authenticated () {
12
+ Serial.println (" Enter is_authenticated " );
13
13
if (server.hasHeader (" Cookie" )) {
14
14
Serial.print (" Found cookie: " );
15
15
String cookie = server.header (" Cookie" );
16
16
Serial.println (cookie);
17
17
if (cookie.indexOf (" ESPSESSIONID=1" ) != -1 ) {
18
- Serial.println (" Authentification Successful" );
18
+ Serial.println (" Authentication Successful" );
19
19
return true ;
20
20
}
21
21
}
22
- Serial.println (" Authentification Failed" );
22
+ Serial.println (" Authentication Failed" );
23
23
return false ;
24
24
}
25
25
@@ -59,11 +59,11 @@ void handleLogin() {
59
59
server.send (200 , " text/html" , content);
60
60
}
61
61
62
- // root page can be accessed only if authentification is ok
62
+ // root page can be accessed only if authentication is ok
63
63
void handleRoot () {
64
64
Serial.println (" Enter handleRoot" );
65
65
String header;
66
- if (!is_authentified ()) {
66
+ if (!is_authenticated ()) {
67
67
server.sendHeader (" Location" , " /login" );
68
68
server.sendHeader (" Cache-Control" , " no-cache" );
69
69
server.send (301 );
@@ -77,7 +77,7 @@ void handleRoot() {
77
77
server.send (200 , " text/html" , content);
78
78
}
79
79
80
- // no need authentification
80
+ // no need authentication
81
81
void handleNotFound () {
82
82
String message = " File Not Found\n\n " ;
83
83
message += " URI: " ;
@@ -114,7 +114,7 @@ void setup(void) {
114
114
server.on (" /" , handleRoot);
115
115
server.on (" /login" , handleLogin);
116
116
server.on (" /inline" , []() {
117
- server.send (200 , " text/plain" , " this works without need of authentification " );
117
+ server.send (200 , " text/plain" , " this works without need of authentication " );
118
118
});
119
119
120
120
server.onNotFound (handleNotFound);
0 commit comments