diff --git a/app/models/oauth.js b/app/models/oauth.js index 1c55ff86..eb0040ec 100644 --- a/app/models/oauth.js +++ b/app/models/oauth.js @@ -138,7 +138,7 @@ var oAuth = function(){ }, function checkSignature(err, data){ if (err) callback(err, null); - callback(err, (signature === data) ? ohash.user_id : null); + callback(err, (signature === data && !_.isUndefined(data)) ? ohash.user_id : null); } ); } diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 33c8d23d..3afe0b77 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -30,7 +30,6 @@ set :use_sudo, false default_run_options[:pty] = true after "deploy", "node:link_directories" -after "deploy", "node:update_dependencies" # ensures ssh-agent is always running before 'deploy:setup', 'deploy:create_deploy_to_with_sudo' diff --git a/test/unit/oauth.test.js b/test/unit/oauth.test.js index 06c0cccc..c43223f4 100644 --- a/test/unit/oauth.test.js +++ b/test/unit/oauth.test.js @@ -199,4 +199,14 @@ tests['returns null user for unverified signatures'] = function(){ }, true) } +tests['returns null user for no oauth'] = function(){ + var req = {query:{}, + method: 'GET', + route: {path: '/api/v1/tables'} + } + + oAuth.verifyRequest(req, function(err, data){ + assert.eql(data, null); + }, true) +}