Skip to content

Commit 26293b5

Browse files
author
Ilya Radchenko
committed
Hookin setup api endpoint, error if invalid post
1 parent 3283b67 commit 26293b5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ var init = exports.init = function (config) {
254254

255255
app.get('/api/session', api_session.get);
256256
app.post('/api/session', api_session.create);
257+
app.use('/api/setup', require('./routes/api/setup'));
257258

258259

259260
app.use(function(req, res, next) {

lib/routes/api/setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ router.post('/', function (req, res) {
1313
var configData = req.body;
1414
var userData = configData.admin;
1515

16+
if (!configData || !userData) {
17+
return res.status(400).send('Invalid post data');
18+
}
19+
1620
Upgrade.needConfigObj(function (err, needsConfig) {
1721
if (err) {
1822
return res.status(500).send('Database error');

0 commit comments

Comments
 (0)