aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;