From 56a7fa727280adcca16fd8460249d2dd49031689 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 22 Dec 2023 01:03:01 +0100 Subject: Add list of forbidden player names. System reserved and easily confused names. --- server.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server.js') diff --git a/server.js b/server.js index 3d58e09..5521c53 100644 --- a/server.js +++ b/server.js @@ -28,6 +28,8 @@ const LIMIT_ACTIVE_GAMES = (process.env.LIMIT_ACTIVE_GAMES | 0) || 29 const REGEX_MAIL = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/ const REGEX_NAME = /^[\p{Alpha}\p{Number}'_-]+( [\p{Alpha}\p{Number}'_-]+)*$/u +const FORBIDDEN_NAME = /^(Deleted|None|Draw|Both|All|null|admin)/i + const WEBHOOKS = process.env.WEBHOOKS | 0 if (WEBHOOKS) console.log("Webhook notifications enabled.") @@ -281,6 +283,8 @@ function is_valid_user_name(name) { return false if (name.length > 50) return false + if (FORBIDDEN_NAME.test(name)) + return false return REGEX_NAME.test(name) } -- cgit v1.2.3