mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
5f5f0021db
no issue - support ends today - see https://github.com/nodejs/Release - removed `use strict`
17 lines
551 B
JavaScript
17 lines
551 B
JavaScript
module.exports.hash = function hash(plainPassword) {
|
|
const bcrypt = require('bcryptjs'),
|
|
bcryptGenSalt = Promise.promisify(bcrypt.genSalt),
|
|
bcryptHash = Promise.promisify(bcrypt.hash);
|
|
|
|
return bcryptGenSalt().then(function (salt) {
|
|
return bcryptHash(plainPassword, salt);
|
|
});
|
|
};
|
|
|
|
module.exports.compare = function compare(plainPassword, hashedPassword) {
|
|
const bcrypt = require('bcryptjs'),
|
|
bcryptCompare = Promise.promisify(bcrypt.compare);
|
|
|
|
return bcryptCompare(plainPassword, hashedPassword);
|
|
};
|