diff options
| -rw-r--r-- | routes/users.ts | 6 |
1 files 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"); |
