aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/fund
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-10 12:36:50 -0700
committerAdam Soltys <[email protected]>2025-07-10 12:36:50 -0700
commit5b458624745c7ea80d1e63c9a6ef77075763ff5f (patch)
tree462e71c86d97ed78eaf5324697350feab8af6a33 /src/routes/(app)/fund
parentee8e20ce1dbcc0476ec698dd8c9d0ff99e260db7 (diff)
downloadcoinos-ui-5b458624745c7ea80d1e63c9a6ef77075763ff5f.tar.gz
coinos-ui-5b458624745c7ea80d1e63c9a6ef77075763ff5f.zip
user onboarding
Diffstat (limited to 'src/routes/(app)/fund')
-rw-r--r--src/routes/(app)/fund/[id]/sweep/+page.server.ts10
-rw-r--r--src/routes/(app)/fund/[id]/sweep/+page.svelte6
2 files changed, 12 insertions, 4 deletions
diff --git a/src/routes/(app)/fund/[id]/sweep/+page.server.ts b/src/routes/(app)/fund/[id]/sweep/+page.server.ts
index 3e0b8dad..d8415ca4 100644
--- a/src/routes/(app)/fund/[id]/sweep/+page.server.ts
+++ b/src/routes/(app)/fund/[id]/sweep/+page.server.ts
@@ -10,18 +10,22 @@ export async function load({ cookies, request, params, parent }) {
const rates = await getRates();
const rate = rates[user?.currency || "USD"];
+ const username = randomName();
+ const password = randomPassword();
+
if (!amount) redirect(307, `/fund/${id}`);
if (!user) {
const ip = request.headers.get("cf-connecting-ip");
user = {
- username: randomName(),
- password: randomPassword(),
+ username,
+ password,
+ fresh: true,
};
await register(user, ip, cookies, `/fund/${id}/sweep`);
}
await post("/take", { amount, id }, auth(cookies));
- return { amount, id, rate, rates };
+ return { amount, id, rate, rates, password };
}
diff --git a/src/routes/(app)/fund/[id]/sweep/+page.svelte b/src/routes/(app)/fund/[id]/sweep/+page.svelte
index 986a84bb..adba77ae 100644
--- a/src/routes/(app)/fund/[id]/sweep/+page.svelte
+++ b/src/routes/(app)/fund/[id]/sweep/+page.svelte
@@ -1,4 +1,6 @@
<script>
+ import { onMount } from "svelte";
+ import { password } from "$lib/store";
import Amount from "$comp/Amount.svelte";
import Success from "$comp/Success.svelte";
import { scale } from "svelte/transition";
@@ -9,9 +11,11 @@
let { data } = $props();
- let { amount, id, user, rate, rates } = data;
+ let { amount, id, user, rate, rates, password: pw } = data;
let { currency } = user;
let locale = $derived(loc(user));
+
+ onMount(() => ($password = pw));
</script>
<div class="container px-4 text-center mx-auto">