diff --git a/options.json b/options.json index 78c6a20..3ae4c7a 100644 --- a/options.json +++ b/options.json @@ -17,7 +17,7 @@ "system" ], "registrationEnabled": true, - "requireCodeForRegister": false, + "requireCodeForRegister": true, "OAuthProviders": [ { "name": "Discord", @@ -55,9 +55,10 @@ }, "logLevel": 0, "logLevelMapping": { - "access": 3, - "unauthorised": 3 + "access": 2, + "unauthorised": 2 }, + "broadcastLevel": 3, "webhook": { "url": "https://discord.com/api/webhooks/1093874668886294548/uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn" } diff --git a/src/server/endpoints/api/Register.ts b/src/server/endpoints/api/Register.ts index 5eabcc9..8669108 100644 --- a/src/server/endpoints/api/Register.ts +++ b/src/server/endpoints/api/Register.ts @@ -52,11 +52,12 @@ class RegisterEndpoint extends ApiEndpoint { if (existing) return void res.status(400).send('Username taken'); - if (this.#requireCodeForRegister) { - if (!code) - return void res.status(400).send('Registration code required for registration at this time'); + if (this.#requireCodeForRegister && !code) { + return void res.status(400).send('Registration code required for registration at this time'); + } else if (code) { + // Consumes codes if given, but will only complain if the code is required const codeCheck = await this.#userdb.consumeRegistrationCode(code); - if (!codeCheck) + if (!codeCheck && this.#requireCodeForRegister) return void res.status(400).send('Invalid registration code'); }