diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-22 01:03:01 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-12-23 02:10:40 +0100 |
commit | 56a7fa727280adcca16fd8460249d2dd49031689 (patch) | |
tree | 43566420465d092f52ccca20d3431a61d34bd68d /server.js | |
parent | da5bc280b65c05d76a65083fd7b8dfd330e7acd3 (diff) | |
download | server-56a7fa727280adcca16fd8460249d2dd49031689.tar.gz |
Add list of forbidden player names.
System reserved and easily confused names.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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) } |