MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / logoutHandler

Function logoutHandler

src/webInterface.cpp:485–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485esp_err_t logoutHandler(httpd_req_t *req) {
486 ensurePersistedSessionLoaded();
487 String cookie = headerValue(req, "Cookie");
488 int idx = cookie.indexOf("ESP32SESSION=");
489 if (idx != -1) {
490 int start = idx + 13;
491 int end = cookie.indexOf(';', start);
492 if (end == -1) end = cookie.length();
493 sessions.erase(cookie.substring(start, end));
494 saveSessionToken("");
495 sessionTokenLoaded = true;
496 persistedSessionToken = "";
497 }
498 httpd_resp_set_status(req, "302 Found");
499 httpd_resp_set_hdr(req, "Location", "/?loggedout");
500 httpd_resp_set_hdr(req, "Set-Cookie", "ESP32SESSION=0; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT");
501 httpd_resp_send(req, nullptr, 0);
502 return ESP_OK;
503}
504
505esp_err_t loggedOutHandler(httpd_req_t *req) {
506#ifdef PART_04MB

Callers

nothing calls this directly

Calls 3

headerValueFunction · 0.85
saveSessionTokenFunction · 0.85

Tested by

no test coverage detected