diff options
Diffstat (limited to 'src/routes/(app)/migrate')
| -rw-r--r-- | src/routes/(app)/migrate/+page.server.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/routes/(app)/migrate/+page.server.ts b/src/routes/(app)/migrate/+page.server.ts index 6559485f..494eb5b8 100644 --- a/src/routes/(app)/migrate/+page.server.ts +++ b/src/routes/(app)/migrate/+page.server.ts @@ -1,4 +1,4 @@ -import { auth, post } from "$lib/utils"; +import { auth, get, post } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; import { env } from "$env/dynamic/private"; @@ -60,8 +60,13 @@ export const actions = { const to = String(form.get("to") || url.searchParams.get("to") || ""); const pin = String(form.get("pin") || ""); const balance = Number(form.get("balance") || 0); - const username = String(form.get("username") || ""); if (!to) return { error: "no destination" }; + // The name handed to the registrar has to be the one this session is + // logged in as. Never take it from the form, or any account could have + // the registrar grant it someone else's @coinos.io name. + const me = await get("/me", auth(cookies)).catch(() => null); + const username = me?.username; + if (!username) return { error: "not logged in" }; let sent = 0; try { |
