| 483 | } |
| 484 | |
| 485 | esp_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 | |
| 505 | esp_err_t loggedOutHandler(httpd_req_t *req) { |
| 506 | #ifdef PART_04MB |
nothing calls this directly
no test coverage detected