From 45239549bf2659998dcf9196d86974b0b625912e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 23 Jan 2016 18:31:58 +0100 Subject: Finalise the join in a network and add the ability to quit it --- middlewares/misc.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'middlewares') diff --git a/middlewares/misc.js b/middlewares/misc.js index 9755eeff0..c10b0792a 100644 --- a/middlewares/misc.js +++ b/middlewares/misc.js @@ -28,7 +28,12 @@ PodsDB.findOne({ url: req.body.signature.url }, function (err, pod) { if (err) { logger.error('Cannot get signed url in decryptBody.', { error: err }) - res.sendStatus(500) + return res.sendStatus(500) + } + + if (pod === null) { + logger.error('Unknown pod %s.', req.body.signature.url) + return res.sendStatus(403) } logger.debug('Decrypting body from %s.', req.body.signature.url) @@ -43,7 +48,7 @@ delete req.body.key } else { logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) - res.sendStatus(500) + return res.sendStatus(403) } next() -- cgit v1.2.3