Use a pure JS bcrypt

This commit is contained in:
Ritchie 2013-09-12 12:09:43 -07:00
parent 7af15ca75b
commit 159eb0076c
2 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ var Model = require('../loopback').Model
, path = require('path') , path = require('path')
, SALT_WORK_FACTOR = 10 , SALT_WORK_FACTOR = 10
, crypto = require('crypto') , crypto = require('crypto')
, bcrypt = require('bcrypt') , bcrypt = require('bcryptjs')
, passport = require('passport') , passport = require('passport')
, LocalStrategy = require('passport-local').Strategy; , LocalStrategy = require('passport-local').Strategy;
@ -138,9 +138,9 @@ User.logout = function (sid, fn) {
User.prototype.hasPassword = function (plain, fn) { User.prototype.hasPassword = function (plain, fn) {
if(this.password && plain) { if(this.password && plain) {
bcrypt.compare(plain, this.password, function(err, isMatch) { bcrypt.compare(plain, this.password, function(err, isMatch) {
if(err) return fn(err); if(err) return fn(err);
fn(null, isMatch); fn(null, isMatch);
}); });
} else { } else {
fn(null, false); fn(null, false);
} }

View File

@ -15,11 +15,11 @@
"loopback-datasource-juggler": "git+ssh://git@github.com:strongloop/loopback-datasource-juggler.git", "loopback-datasource-juggler": "git+ssh://git@github.com:strongloop/loopback-datasource-juggler.git",
"strong-remoting": "git+ssh://git@github.com:strongloop/strong-remoting.git", "strong-remoting": "git+ssh://git@github.com:strongloop/strong-remoting.git",
"inflection": "~1.2.5", "inflection": "~1.2.5",
"bcrypt": "~0.7.6",
"passport": "~0.1.17", "passport": "~0.1.17",
"passport-local": "~0.1.6", "passport-local": "~0.1.6",
"nodemailer": "~0.4.4", "nodemailer": "~0.4.4",
"ejs": "~0.8.4" "ejs": "~0.8.4",
"bcryptjs": "~0.7.10"
}, },
"devDependencies": { "devDependencies": {
"blanket": "~1.1.5", "blanket": "~1.1.5",