Skip to content

Commit 72b20cd

Browse files
author
Ilya Radchenko
committed
Hookin setup api endpoint, error if invalid post
1 parent 4e466df commit 72b20cd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ var init = exports.init = function (config) {
255255

256256
app.get('/api/session', api_session.get);
257257
app.post('/api/session', api_session.create);
258+
app.use('/api/setup', require('./routes/api/setup'));
258259

259260

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

lib/routes/api/setup.js

+4
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)