Skip to content

Commit 9dfa595

Browse files
committed
Logoff Cookie Authentication in the example
1 parent d0efc37 commit 9dfa595

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

examples/SmartSwitch/SmartSwitch.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ Use latest ESP core lib (from Github)
2323

2424
//See https://github.com/me-no-dev/ESPAsyncWebServer/pull/684
2525
#define USE_AUTH_COOKIE
26-
#define MY_COOKIE_FULL "LLKQ=7;max-age=31536000;"
27-
#define MY_COOKIE_DEL "LLKQ="
28-
#define MY_COOKIE "LLKQ=7"
26+
// 1 year age, path helps Safari to unset
27+
#define MY_COOKIE_FULL "LLKQ=3; Max-Age=31536000; Path=/;"
28+
#define MY_COOKIE_DEL "LLKQ=; Max-Age=-1; Path=/;"
29+
#define MY_COOKIE "LLKQ=3"
2930

3031
#ifndef USE_AUTH_COOKIE
3132
#define USE_AUTH_STAT //Base Auth for stat, /commands and SPIFFSEditor

examples/SmartSwitch/data/index.htm

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@
329329
<div id="g2" class="gauge"></div>
330330
<div id="C" class="clk" onclick="getBtime();"></div>
331331
<div id="C2" class="clk2"></div>
332+
<p><a href="/login">Logoff</a></p>
332333
</div>
333334

334335
<script src="app.min.js"></script>

examples/SmartSwitch/data/login/index.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<br><br>
1313
<h4>Password</h4>
1414
<form action="/lg2n" method="post">
15-
<input type="password" name="pa2w">
15+
<input type="password" name="pa2w"><br><br>
1616
<input type="checkbox" name="lg0f"><label for="lg0f">Logoff</label><br><br>
1717
<input type="submit" value="Submit">
1818
</form></center>

0 commit comments

Comments
 (0)