This commit is contained in:
Florent Vilmart
2016-04-11 14:27:55 -04:00
committed by Drew
parent 281568edd2
commit 73a3db44ab
2 changed files with 27 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ function hash(password) {
// hashed password.
function compare(password, hashedPassword) {
return new Promise(function(fulfill, reject) {
// Cannot bcrypt compare when one is undefined
if (!password || !hashedPassword) {
return fulfill(false);
}
bcrypt.compare(password, hashedPassword, function(err, success) {
if (err) {
reject(err);