aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-08-07 08:45:36 -0700
committerAdam Soltys <[email protected]>2025-08-07 08:45:36 -0700
commit0da54f2b44b3421f45e7db01e0cb167f1c097289 (patch)
tree32d8f2d84f128bc5373d99c407cfd9179e53e8fd
parentd85cc4db731e8cd0b93f64f63ed861716d4b2e04 (diff)
downloadcoinos-server-0da54f2b44b3421f45e7db01e0cb167f1c097289.tar.gz
coinos-server-0da54f2b44b3421f45e7db01e0cb167f1c097289.zip
reserved usernames
-rw-r--r--lib/register.ts2
-rw-r--r--routes/users.ts2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/register.ts b/lib/register.ts
index 107be6ea..8e999e76 100644
--- a/lib/register.ts
+++ b/lib/register.ts
@@ -15,10 +15,12 @@ export default async (user, ip) => {
let { password, pubkey, username } = user;
l("registering", username);
+ const reserved = ["ecash"];
if (!username) fail("Username required");
username = username.toLowerCase().replace(/\s/g, "");
if (!valid.test(username))
fail("Usernames can only have letters and numbers");
+ if (reserved.includes(username)) fail("Invalid username");
const id = v4();
user.id = id;
diff --git a/routes/users.ts b/routes/users.ts
index 34c2a655..dc007f05 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -196,9 +196,11 @@ export default {
const { confirm, password, pin, newpin } = body;
const username = body?.username?.toLowerCase().replace(/\s/g, "");
+ const reserved = ["ecash"];
const valid = /^[\p{L}\p{N}]{2,24}$/u;
if (!valid.test(username))
fail("Usernames can only have letters and numbers");
+ if (reserved.includes(username)) fail("Invalid username");
let exists;