From da81588951eccdb4621e101a38719e6ccd73727c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 25 Apr 2016 16:25:32 -0400 Subject: [PATCH] Fixed error message when unauthorized google user tries to login Fixes HospitalRun/hospitalrun-frontend#433 --- routes/30-auth.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/routes/30-auth.js b/routes/30-auth.js index 148800e..8bb44a2 100644 --- a/routes/30-auth.js +++ b/routes/30-auth.js @@ -106,15 +106,16 @@ module.exports = function(app, config) { var userKey = 'org.couchdb.user:' + profile.emails[0].value; users.get(userKey, {}, function(err, body) { if (err) { - if (err.status_code === 404) { - callback(); + if (err.error && err.error === 'not_found') { + callback(null, false); } else { callback(err); } return; } if (body.deleted) { - callback(); + callback(null, false); + return; } if (validateOAuth(body.oauth)) { return callback(null, denormalizeOAuth(body));