mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
always pass strings to bcrypt compare
This commit is contained in:
@@ -9,7 +9,7 @@ process.on('message', function (msg) {
|
||||
if (msg.type === 'hash') {
|
||||
hashPassword(msg.password, msg.rounds);
|
||||
} else if (msg.type === 'compare') {
|
||||
bcrypt.compare(msg.password, msg.hash, done);
|
||||
bcrypt.compare(String(msg.password || ''), String(msg.hash || ''), done);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
};
|
||||
|
||||
module.compare = function (password, hash, callback) {
|
||||
if (!hash || !password) {
|
||||
return setImmediate(callback, null, false);
|
||||
}
|
||||
forkChild({ type: 'compare', password: password, hash: hash }, callback);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user