Skip to content

Commit

Permalink
fix typo (esp8266#5189)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragondaud authored and devyte committed Sep 30, 2018
1 parent 270788b commit 678c7be
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ const char* password = "........";
ESP8266WebServer server(80);

//Check if header is present and correct
bool is_authentified() {
Serial.println("Enter is_authentified");
bool is_authenticated() {
Serial.println("Enter is_authenticated");
if (server.hasHeader("Cookie")) {
Serial.print("Found cookie: ");
String cookie = server.header("Cookie");
Serial.println(cookie);
if (cookie.indexOf("ESPSESSIONID=1") != -1) {
Serial.println("Authentification Successful");
Serial.println("Authentication Successful");
return true;
}
}
Serial.println("Authentification Failed");
Serial.println("Authentication Failed");
return false;
}

Expand Down Expand Up @@ -59,11 +59,11 @@ void handleLogin() {
server.send(200, "text/html", content);
}

//root page can be accessed only if authentification is ok
//root page can be accessed only if authentication is ok
void handleRoot() {
Serial.println("Enter handleRoot");
String header;
if (!is_authentified()) {
if (!is_authenticated()) {
server.sendHeader("Location", "/login");
server.sendHeader("Cache-Control", "no-cache");
server.send(301);
Expand All @@ -77,7 +77,7 @@ void handleRoot() {
server.send(200, "text/html", content);
}

//no need authentification
//no need authentication
void handleNotFound() {
String message = "File Not Found\n\n";
message += "URI: ";
Expand Down Expand Up @@ -114,7 +114,7 @@ void setup(void) {
server.on("/", handleRoot);
server.on("/login", handleLogin);
server.on("/inline", []() {
server.send(200, "text/plain", "this works without need of authentification");
server.send(200, "text/plain", "this works without need of authentication");
});

server.onNotFound(handleNotFound);
Expand Down

0 comments on commit 678c7be

Please sign in to comment.