aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(static)
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-07 14:42:03 -0800
committerAdam Soltys <[email protected]>2025-01-07 14:42:03 -0800
commit2358d1bf39c34a508db6c50f0f6312ee411a8a17 (patch)
treec1a592710013c0db2f4d992f6884f4fd371f125d /src/routes/(static)
parent493cb3a3504fdc2791d47fd032f5ac9d2ccc66b7 (diff)
downloadcoinos-ui-2358d1bf39c34a508db6c50f0f6312ee411a8a17.tar.gz
coinos-ui-2358d1bf39c34a508db6c50f0f6312ee411a8a17.zip
nostr signin
Diffstat (limited to 'src/routes/(static)')
-rw-r--r--src/routes/(static)/login/+page.svelte2
-rw-r--r--src/routes/(static)/register/+page.server.ts7
-rw-r--r--src/routes/(static)/register/+page.svelte21
3 files changed, 13 insertions, 17 deletions
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte
index ca6ebf73..7e8234ee 100644
--- a/src/routes/(static)/login/+page.svelte
+++ b/src/routes/(static)/login/+page.svelte
@@ -164,4 +164,4 @@
</div>
{/if}
-<Nostr {id} {nostrSignin} {redirect} {token} />
+<Nostr {id} bind:nostrSignin {redirect} {token} />
diff --git a/src/routes/(static)/register/+page.server.ts b/src/routes/(static)/register/+page.server.ts
index 561b34a0..bf908c54 100644
--- a/src/routes/(static)/register/+page.server.ts
+++ b/src/routes/(static)/register/+page.server.ts
@@ -1,4 +1,4 @@
-import { get, fd, login, post } from "$lib/utils";
+import { fd, get, login, post } from "$lib/utils";
import { fail, redirect } from "@sveltejs/kit";
export const load = async ({ parent }) => {
@@ -16,9 +16,8 @@ export const actions = {
const ip = request.headers.get("cf-connecting-ip");
const form = await fd(request);
- let { picture, username, password, cipher, salt, pubkey, loginRedirect } =
- form;
- const user = { picture, username, password, cipher, salt, pubkey };
+ let { picture, username, password, pubkey, loginRedirect } = form;
+ const user = { picture, username, password, pubkey };
let error;
if (loginRedirect === "undefined") loginRedirect = undefined;
diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte
index 69c6a588..77394e1a 100644
--- a/src/routes/(static)/register/+page.svelte
+++ b/src/routes/(static)/register/+page.svelte
@@ -1,6 +1,5 @@
<script>
import { browser } from "$app/environment";
- import { onMount } from "svelte";
import punks from "$lib/punks";
import { upload } from "$lib/upload";
import { afterNavigate, invalidateAll } from "$app/navigation";
@@ -9,6 +8,7 @@
import { fly } from "svelte/transition";
import { enhance } from "$app/forms";
+ import Nostr from "$comp/Nostr.svelte";
import Pin from "$comp/Pin.svelte";
import Spinner from "$comp/Spinner.svelte";
import PasswordInput from "$comp/PasswordInput.svelte";
@@ -26,12 +26,9 @@
} from "unique-names-generator";
let { form, data } = $props();
- let nostr = $state();
let { id } = $derived(data);
- onMount(() => {
- if (browser && window.nostr) nostr = true;
- });
+ let nostrSignin = $state();
let username = $state();
let { index } = $state(data);
@@ -113,7 +110,7 @@
} catch (e) {
console.log("problem uploading avatar", e);
}
- }
+ }
const response = await fetch("/register", {
method: "POST",
@@ -312,12 +309,10 @@
{/if}
</button>
- {#if nostr}
- <button type="button" class="btn" onclick={nostrLogin}>
- <img src="/images/nostr.png" class="w-8" />
- <div class="my-auto">{$t("login.nostr")}</div>
- </button>
- {/if}
+ <button type="button" class="btn" onclick={() => (nostrSignin = true)}>
+ <img src="/images/nostr.png" class="w-8" />
+ <div class="my-auto">{$t("login.nostr")}</div>
+ </button>
<p class="text-secondary text-center font-medium">
{$t("login.haveAccount")}
@@ -330,3 +325,5 @@
</p>
</form>
</div>
+
+<Nostr {id} {nostrSignin} {redirect} {token} />