From d86e0ab8de6cd558568301c470bd4c1e163177ba Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 18 Nov 2024 05:34:38 -0500 Subject: Add logout --- src/Auth.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Auth.js') diff --git a/src/Auth.js b/src/Auth.js index 81ddad9..3c50658 100644 --- a/src/Auth.js +++ b/src/Auth.js @@ -44,3 +44,17 @@ export const _getToken = (Just) => (Nothing) => (pair) => () => { if (token && authnonce) return Just(pair(token)(authnonce)); return Nothing; }; + +export const _getSessionCookie = (Just) => (Nothing) => () => { + let cookie = null; + for (let c of document.cookie.split("; ")) { + const [k, v] = c.split("="); + if (k === "authelia_session") cookie = v; + } + if (cookie) return Just(cookie); + return Nothing; +}; + +export const _clearSessionCookie = () => { + document.cookie = "authelia_session=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=None; Secure"; +}; -- cgit v1.2.3