Finish UsersError removal

This commit is contained in:
Girish Ramakrishnan
2019-10-24 15:12:58 -07:00
parent 03175aa8de
commit 4793eb9ef5
7 changed files with 54 additions and 58 deletions

View File

@@ -31,7 +31,6 @@ var assert = require('assert'),
debug = require('debug')('box:accesscontrol'),
tokendb = require('./tokendb.js'),
users = require('./users.js'),
UsersError = users.UsersError,
_ = require('underscore');
// returns scopes that does not have wildcards and is sorted
@@ -125,7 +124,7 @@ function validateToken(accessToken, callback) {
if (error) return callback(error); // this triggers 'internal error' in passport
users.get(token.identifier, function (error, user) {
if (error && error.reason === UsersError.NOT_FOUND) return callback(null, null /* user */, 'Invalid Token'); // will end up as a 401
if (error && error.reason === BoxError.NOT_FOUND) return callback(null, null /* user */, 'Invalid Token'); // will end up as a 401
if (error) return callback(error);
if (!user.active) return callback(null, null /* user */, 'Invalid Token'); // will end up as a 401