Skip to content

Commit

Permalink
refactor, unnecesary if
Browse files Browse the repository at this point in the history
  • Loading branch information
afontainec committed Jul 5, 2020
1 parent fdd11e2 commit d6d5d6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/middleware/accessToken.js
Expand Up @@ -22,7 +22,7 @@ const decode = async (req, res, next) => {
const authorizationHeader = req.get('Authorization');
const token = extractToken(authorizationHeader);
const decoded = decryptToken(token);
if (!hasExpired(decoded)) await addIsAuthenticated(req, decoded);
await addIsAuthenticated(req, decoded);
return next();
} catch (error) {
if (error.chinchayCode === 'middlewareMissingTheWall') console.log(`WARNING: ${error.message} req.isAuthenticatedByToken() will return false.`);
Expand Down
2 changes: 1 addition & 1 deletion test/models/middleware/accessToken/decode.js
Expand Up @@ -67,7 +67,7 @@ describe('Middleware: accessToken: decode', () => { // eslint-disable-line
const req = Req.generate();
const token = jwt.sign({ user: 1, exp: YESTERDAY }, secret);
req.headers.Authorization = `Bearer ${token}`;
delete req.isAuthenticated;
delete req.isAuthenticatedByToken;
accessToken.decode(req, null, () => {
assert.isUndefined(req.user);
assert.isFalse(req.isAuthenticatedByToken());
Expand Down

0 comments on commit d6d5d6f

Please sign in to comment.