From 8e5ac488b55d3fe84a5b8e4ba28310a9da2a6e0d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 23 Jun 2025 15:50:07 +0000 Subject: check username --- routes/users.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/routes/users.ts b/routes/users.ts index b28d34c6..c35d4b55 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -206,10 +206,8 @@ export default { if (pubkey) { pubkey = pubkey.trim(); exists = await getUser(pubkey); - const existingUsername = exists.username - .toLowerCase() - .replace(/\s/g, ""); - if (exists && ![username].includes(existingUsername)) { + let existingUsername = exists?.username?.toLowerCase().replace(/\s/g,""); + if (exists && username !== existingUsername) { warn("key in use", pubkey, existingUsername); if (exists.anon) await db.del(`user:${pubkey}`); else fail("Key in use by another account"); -- cgit v1.2.3