From 7d1882895b8ad1c6c26f4e9df86e28fc6b350801 Mon Sep 17 00:00:00 2001 From: hippoz Date: Fri, 11 Dec 2020 00:36:52 +0200 Subject: [PATCH] yayyy not testing commits --- api/v1/users.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/api/v1/users.js b/api/v1/users.js index 30eeb7f..d631244 100755 --- a/api/v1/users.js +++ b/api/v1/users.js @@ -50,19 +50,21 @@ app.post('/account/create', [ return; } - const restrictions = config.restrictions.signup; - if (restrictions && restrictions.specialCode) { - const passedSpecialCode = req.body.specialCode; - const specialCode = restrictions.specialCode; - - if (passedSpecialCode && specialCode) { - if (specialCode !== passedSpecialCode) { + if (config.restrictions) { + const restrictions = config.restrictions.signup; + if (restrictions && restrictions.specialCode) { + const passedSpecialCode = req.body.specialCode; + const specialCode = restrictions.specialCode; + + if (passedSpecialCode && specialCode) { + if (specialCode !== passedSpecialCode) { + res.status(401).json({ error: true, message: 'ERROR_REQUEST_SPECIAL_CODE_MISSING', errors: [{ msg: 'No specialCode passed', param: 'specialCode', location: 'body' }] }); + return false; + } + } else { res.status(401).json({ error: true, message: 'ERROR_REQUEST_SPECIAL_CODE_MISSING', errors: [{ msg: 'No specialCode passed', param: 'specialCode', location: 'body' }] }); return false; } - } else { - res.status(401).json({ error: true, message: 'ERROR_REQUEST_SPECIAL_CODE_MISSING', errors: [{ msg: 'No specialCode passed', param: 'specialCode', location: 'body' }] }); - return false; } }