destroy session on dropbox webhook

This commit is contained in:
Henry Oswald 2014-09-10 14:19:44 +01:00
parent c08a568664
commit 1b02dc72a3
2 changed files with 6 additions and 1 deletions

View file

@ -4,6 +4,7 @@ DropboxWebhookHandler = require("./DropboxWebhookHandler")
module.exports = DropboxWebhookController =
verify: (req, res, next = (error) ->) ->
res.send(req.query.challenge)
req.session.destroy()
webhook: (req, res, next = (error) ->) ->
dropbox_uids = req.body?.delta?.users
@ -16,4 +17,5 @@ module.exports = DropboxWebhookController =
if error?
logger.error err: error, dropbox_uids: dropbox_uids, "error in webhook"
res.send(200)
res.send(200)
req.session.destroy()

View file

@ -6,6 +6,9 @@ modulePath = require('path').join __dirname, '../../../../app/js/Features/Dropbo
describe 'DropboxWebhookController', ->
beforeEach ->
@req =
session:
destroy: ->
@DropboxWebhookController = SandboxedModule.require modulePath, requires:
"./DropboxWebhookHandler": @DropboxWebhookHandler = {}