From 4912a0dbe7b1df1e884b53544943319f8f0c0ebb Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 30 Dec 2021 16:34:50 +0100 Subject: barebones authentication --- web/pw-server/src/lib/auth.ts | 7 +++++ web/pw-server/src/routes/login.svelte | 46 ++++++++++++++++++++++++++++++++ web/pw-server/src/routes/register.svelte | 38 ++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 web/pw-server/src/lib/auth.ts create mode 100644 web/pw-server/src/routes/login.svelte create mode 100644 web/pw-server/src/routes/register.svelte diff --git a/web/pw-server/src/lib/auth.ts b/web/pw-server/src/lib/auth.ts new file mode 100644 index 0000000..436ec66 --- /dev/null +++ b/web/pw-server/src/lib/auth.ts @@ -0,0 +1,7 @@ +export function set_session_token(token: string) { + window.localStorage.setItem('session', token); +} + +export function get_session_token(): string | null { + return window.localStorage.getItem('session'); +} \ No newline at end of file diff --git a/web/pw-server/src/routes/login.svelte b/web/pw-server/src/routes/login.svelte new file mode 100644 index 0000000..197238e --- /dev/null +++ b/web/pw-server/src/routes/login.svelte @@ -0,0 +1,46 @@ + + +{#if loggedIn()} + you are logged in +{/if} + +
+ + + + + +
diff --git a/web/pw-server/src/routes/register.svelte b/web/pw-server/src/routes/register.svelte new file mode 100644 index 0000000..a21cf65 --- /dev/null +++ b/web/pw-server/src/routes/register.svelte @@ -0,0 +1,38 @@ + + +

Register

+
+ + + + + +
-- cgit v1.2.3