From 741cf724ae6cff9b023016b9a6f42a8a9f23647c Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Tue, 26 Feb 2019 00:18:03 +0000 Subject: [webapp/setup] StartPageSetup now uses the new UserCreateForm component & small fixes --- server/api/authentication.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/api/authentication.js') diff --git a/server/api/authentication.js b/server/api/authentication.js index 050031c..18158ce 100644 --- a/server/api/authentication.js +++ b/server/api/authentication.js @@ -20,8 +20,8 @@ noAuthRouter.post('/logout', (req, res) => { // Setup method for creating the initial root account. noAuthRouter.post('/setup', (req, res) => { db.user.findAll().then(users => { - if (users.length > 0) res.send({ status: 'USERTABLE_NOT_EMPTY', error_message: 'The user table is not empty, unauthorized creation is forbidden.' }) - else if (req.body.username) authentication.signup(req, res) + if (users.length > 0) res.status(500).send({ status: 'USERTABLE_NOT_EMPTY', error_message: 'The user table is not empty, unauthorized creation is forbidden.' }) + else if (req.body.username) return authentication.signup(req, res) else res.send({ status: 'SUCCESS' }) }) }) -- cgit v1.2.3-55-g7522