fix registration flow
This commit is contained in:
parent
214e00d291
commit
175dea1877
@ -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"
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user