diff options
| author | LLLL Colonq <llll@colonq> | 2024-11-18 05:34:38 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-11-18 05:34:38 -0500 |
| commit | d86e0ab8de6cd558568301c470bd4c1e163177ba (patch) | |
| tree | 235c8efc82e278662e40b8239ba3feaec75ebcda /src/Auth.js | |
| parent | 07adfbdcb959e2a789551e516bd389ce0002c6f8 (diff) | |
Add logout
Diffstat (limited to 'src/Auth.js')
| -rw-r--r-- | src/Auth.js | 14 |
1 files changed, 14 insertions, 0 deletions
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"; +}; |
