Skip to content

Commit

Permalink
Merge pull request #1 from jacques/master
Browse files Browse the repository at this point in the history
bcrypt api changes (in bcrypt 0.5).
  • Loading branch information
trentm committed Mar 16, 2012
2 parents 20980e1 + 94f8db4 commit 5a7b6d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function LdapAuth(opts) {
this._adminBound = false;
this._userClient = ldap.createClient(clientOpts);

this._salt = bcrypt.gen_salt_sync();
this._salt = bcrypt.genSaltSync();
}


Expand Down Expand Up @@ -158,7 +158,7 @@ LdapAuth.prototype.authenticate = function (username, password, callback) {
if (self.opts.cache) {
// Check cache. "cached" is `{password: <hashed-password>, user: <user>}`.
var cached = self.userCache.get(username);
if (cached && bcrypt.compare_sync(password, cached.password)) {
if (cached && bcrypt.compareSync(password, cached.password)) {
return callback(null, cached.user)
}
}
Expand All @@ -174,7 +174,7 @@ LdapAuth.prototype.authenticate = function (username, password, callback) {
return callback(err);
}
if (self.opts.cache) {
bcrypt.encrypt(password, self._salt, function(err, hash) {
bcrypt.hash(password, self._salt, function(err, hash) {
self.userCache.set(username, {password: hash, user: user});
return callback(null, user);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ldapauth",
"version": "1.0.2",
"version": "1.0.3",
"main": "./lib/ldapauth.js",
"description": "Authenticate against an LDAP server",
"author": "Trent Mick <trentm@gmail.com> (http://trentm.com)",
Expand Down

0 comments on commit 5a7b6d1

Please sign in to comment.