(req: http.IncomingMessage, res: http.ServerResponse)
| 475 | } |
| 476 | |
| 477 | private handleLogout(req: http.IncomingMessage, res: http.ServerResponse): void { |
| 478 | const cookie = req.headers.cookie ?? ""; |
| 479 | const re = new RegExp(`${this.cookieName}=([a-f0-9]+)`); |
| 480 | const match = cookie.match(re); |
| 481 | if (match) this.auth.sessions.delete(match[1]); |
| 482 | res.writeHead(200, { |
| 483 | "Content-Type": "application/json", |
| 484 | "Set-Cookie": `${this.cookieName}=; Path=/; HttpOnly; Max-Age=0`, |
| 485 | }); |
| 486 | res.end(JSON.stringify({ ok: true })); |
| 487 | } |
| 488 | |
| 489 | private handlePasswordReset(req: http.IncomingMessage, res: http.ServerResponse): void { |
| 490 | this.readBody(req, (body) => { |
no test coverage detected