From f99bd15fabd6d7b361794f756a69d6f05a50701f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Nov 2024 22:35:28 -0800 Subject: warnings --- src/routes/(static)/docs/+page.svelte | 37 +++++++++-------- src/routes/(static)/forgot/+page.server.ts | 14 +++++++ src/routes/(static)/forgot/+page.svelte | 66 ++++++++++++++++++++++++++++++ src/routes/(static)/login/+page.svelte | 38 +++-------------- src/routes/(static)/register/+page.svelte | 50 ++++------------------ 5 files changed, 113 insertions(+), 92 deletions(-) create mode 100644 src/routes/(static)/forgot/+page.server.ts create mode 100644 src/routes/(static)/forgot/+page.svelte (limited to 'src/routes/(static)') diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index 80052805..f4e2ffb9 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -18,12 +18,17 @@ : `export token=`; +{#snippet cp(something)} + +{/snippet} +

Documentation

- Coinos is free and open source software. The code is - available at github.com/coinos @@ -31,19 +36,18 @@

Coinos has a REST API that can be used to register accounts and make - payments. The following examples show how you can call the API - with curl + payments. The following examples show how you can call the API with curl

API Base URL

-
+
{api}
- copy(api)} - width="42" - class="ml-auto cursor-pointer" - > + {@render cp(api)}

Auth Token

@@ -58,14 +62,11 @@ Save it in a variable called $token to run the examples.

-
+
{tokenSample}
- copy(tokenSample)} - width="42" - class="ml-auto cursor-pointer" - > + {@render cp(tokenSample)}

POST /register

diff --git a/src/routes/(static)/forgot/+page.server.ts b/src/routes/(static)/forgot/+page.server.ts new file mode 100644 index 00000000..55169a5e --- /dev/null +++ b/src/routes/(static)/forgot/+page.server.ts @@ -0,0 +1,14 @@ +import { fail } from "@sveltejs/kit"; +import { fd, post } from "$lib/utils"; + +export const actions = { + default: async ({ request }) => { + try { + const { email } = await fd(request); + await post("/forgot", { email }); + return { success: true }; + } catch (e: any) { + return fail(400, { error: e.message }); + } + }, +}; diff --git a/src/routes/(static)/forgot/+page.svelte b/src/routes/(static)/forgot/+page.svelte new file mode 100644 index 00000000..45180543 --- /dev/null +++ b/src/routes/(static)/forgot/+page.svelte @@ -0,0 +1,66 @@ + + +
+

{$t("login.reset")}

+ + {#if form?.error} +
+ {form.error} +
+ {/if} + + {#if form?.success} +
+ {$t("login.resetSent")} +
+ + + {:else} +
+
+ +
+ +
+ {$t("login.resetDesc")} + support@coinos.io +
+ + +
+ {/if} +
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte index 2b36dcfe..5caf48fb 100644 --- a/src/routes/(static)/login/+page.svelte +++ b/src/routes/(static)/login/+page.svelte @@ -8,6 +8,7 @@ import { fly } from "svelte/transition"; import { enhance } from "$app/forms"; import Pinpad from "$comp/Pinpad.svelte"; + import PasswordInput from "$comp/PasswordInput.svelte"; import { focus, fail } from "$lib/utils"; import { password, pin, loginRedirect } from "$lib/store"; import { t } from "$lib/translations"; @@ -105,38 +106,7 @@ placeholder={$t("login.username")} /> - +