diff --git a/lib/models/user.js b/lib/models/user.js index 500f0cc0..86f44f74 100644 --- a/lib/models/user.js +++ b/lib/models/user.js @@ -7,7 +7,7 @@ var Model = require('../loopback').Model , path = require('path') , SALT_WORK_FACTOR = 10 , crypto = require('crypto') - , bcrypt = require('bcrypt') + , bcrypt = require('bcryptjs') , passport = require('passport') , LocalStrategy = require('passport-local').Strategy; @@ -138,9 +138,9 @@ User.logout = function (sid, fn) { User.prototype.hasPassword = function (plain, fn) { if(this.password && plain) { bcrypt.compare(plain, this.password, function(err, isMatch) { - if(err) return fn(err); - fn(null, isMatch); - }); + if(err) return fn(err); + fn(null, isMatch); + }); } else { fn(null, false); } diff --git a/package.json b/package.json index 63d409c3..4a478611 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,11 @@ "loopback-datasource-juggler": "git+ssh://git@github.com:strongloop/loopback-datasource-juggler.git", "strong-remoting": "git+ssh://git@github.com:strongloop/strong-remoting.git", "inflection": "~1.2.5", - "bcrypt": "~0.7.6", "passport": "~0.1.17", "passport-local": "~0.1.6", "nodemailer": "~0.4.4", - "ejs": "~0.8.4" + "ejs": "~0.8.4", + "bcryptjs": "~0.7.10" }, "devDependencies": { "blanket": "~1.1.5",