From 0559a382066722b794e1aaaafbb24266c7302f9e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 27 Mar 2023 21:09:22 -0700 Subject: strip spaces from usernames --- routes/lnurl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'routes/lnurl.js') diff --git a/routes/lnurl.js b/routes/lnurl.js index cad209c5..97e4e8f8 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -1,6 +1,6 @@ import { g, s } from "$lib/db"; import { l, warn } from "$lib/logging"; -import { bail, fail } from "$lib/utils"; +import { bail, getUser, fail } from "$lib/utils"; import { v4 } from "uuid"; import got from "got"; import { generate } from "$lib/invoices"; @@ -42,7 +42,7 @@ export default { }, async lnurlp({ params: { username } }, res) { - let uid = await g(`user:${username.toLowerCase()}`); + let uid = await getUser(username); if (!uid) { let u = await got(`${classic}/admin/migrate/${username}?zero=true`, { headers: { authorization: `Bearer ${admin}` }, @@ -56,7 +56,7 @@ export default { u = { id: uid, about: u.address, ...pick(u, fields) }; delete u.address; - await s(`user:${username.toLowerCase()}`, uid); + await s(`user:${username.replace(/\s/g, '').toLowerCase()}`, uid); await s(`user:${uid}`, u); await s(`balance:${uid}`, balance); -- cgit v1.2.3