diff --git a/ghost/security/lib/password.js b/ghost/security/lib/password.js index 697e0be986..4f4580f9fd 100644 --- a/ghost/security/lib/password.js +++ b/ghost/security/lib/password.js @@ -1,18 +1,9 @@ -const Promise = require('bluebird'); - -module.exports.hash = function hash(plainPassword) { - const bcrypt = require('bcryptjs'); - const bcryptGenSalt = Promise.promisify(bcrypt.genSalt); - const bcryptHash = Promise.promisify(bcrypt.hash); - - return bcryptGenSalt().then(function (salt) { - return bcryptHash(plainPassword, salt); - }); +const bcrypt = require('bcryptjs'); +module.exports.hash = async function hash(plainPassword) { + const salt = await bcrypt.genSalt(); + return bcrypt.hash(plainPassword, salt); }; module.exports.compare = function compare(plainPassword, hashedPassword) { - const bcrypt = require('bcryptjs'); - const bcryptCompare = Promise.promisify(bcrypt.compare); - - return bcryptCompare(plainPassword, hashedPassword); + return bcrypt.compare(plainPassword, hashedPassword); }; diff --git a/ghost/security/lib/string.js b/ghost/security/lib/string.js index b2d1367ad8..b9ffc70cce 100644 --- a/ghost/security/lib/string.js +++ b/ghost/security/lib/string.js @@ -1,10 +1,8 @@ -const _ = require('lodash'); const slugify = require('@tryghost/string').slugify; -module.exports.safe = function safe(string, options) { - options = options || {}; +module.exports.safe = function safe(string, options = {}) { let opts = {requiredChangesOnly: true}; - if (!_.has(options, 'importing') || !options.importing) { + if (!('importing' in options) || !options.importing) { opts.requiredChangesOnly = false; } return slugify(string, opts); diff --git a/ghost/security/package.json b/ghost/security/package.json index 725b506b01..07fe83ff4c 100644 --- a/ghost/security/package.json +++ b/ghost/security/package.json @@ -22,8 +22,6 @@ }, "dependencies": { "@tryghost/string": "0.1.26", - "bcryptjs": "2.4.3", - "bluebird": "3.7.2", - "lodash": "4.17.21" + "bcryptjs": "2.4.3" } }