From 48e5579a8c11ca221fbe7430c27f0150df244ad6 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Tue, 1 Mar 2022 19:54:56 -0500 Subject: [PATCH] edit regex validation --- src/commands/cwg_selfserv.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/commands/cwg_selfserv.ts b/src/commands/cwg_selfserv.ts index 123cad3..91ea39b 100644 --- a/src/commands/cwg_selfserv.ts +++ b/src/commands/cwg_selfserv.ts @@ -20,7 +20,6 @@ export default class CWG_SelfService extends Command { } public async run(message: Message, args: string[]) { - console.log(args); const reqDomain = `${escape(args[0])}.cloud.libraryofcode.org`; try { @@ -114,8 +113,7 @@ export default class CWG_SelfService extends Command { } public domainTextValidation(domain: string) { - if (/[^\w\s-]/.test(domain.trim().toLowerCase())) return false; - return true; + return /[A-Za-z0-9](?:[A-Za-z0-9-]{0,19}[A-Za-z0-9])?/.test(domain); } public async checkAuthorizationToken(userID: string, token: string) {