node-express-mongodb-jwt-rest-api-skeleton
Version:
Node.js express.js MongoDB JWT REST API - This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API)
11 lines (8 loc) • 354 B
JavaScript
const LOGIN_ATTEMPTS = 5
/**
* Checks that login attempts are greater than specified in constant and also that blockexpires is less than now
* @param {Object} user - user object
*/
const blockIsExpired = ({ loginAttempts = 0, blockExpires = '' }) =>
loginAttempts > LOGIN_ATTEMPTS && blockExpires <= new Date()
module.exports = { blockIsExpired }