Skip to content

Commit 5a7b6d1

Browse files
committed
Merge pull request vesse#1 from jacques/master
bcrypt api changes (in bcrypt 0.5).
2 parents 20980e1 + 94f8db4 commit 5a7b6d1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/ldapauth.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function LdapAuth(opts) {
6767
this._adminBound = false;
6868
this._userClient = ldap.createClient(clientOpts);
6969

70-
this._salt = bcrypt.gen_salt_sync();
70+
this._salt = bcrypt.genSaltSync();
7171
}
7272

7373

@@ -158,7 +158,7 @@ LdapAuth.prototype.authenticate = function (username, password, callback) {
158158
if (self.opts.cache) {
159159
// Check cache. "cached" is `{password: <hashed-password>, user: <user>}`.
160160
var cached = self.userCache.get(username);
161-
if (cached && bcrypt.compare_sync(password, cached.password)) {
161+
if (cached && bcrypt.compareSync(password, cached.password)) {
162162
return callback(null, cached.user)
163163
}
164164
}
@@ -174,7 +174,7 @@ LdapAuth.prototype.authenticate = function (username, password, callback) {
174174
return callback(err);
175175
}
176176
if (self.opts.cache) {
177-
bcrypt.encrypt(password, self._salt, function(err, hash) {
177+
bcrypt.hash(password, self._salt, function(err, hash) {
178178
self.userCache.set(username, {password: hash, user: user});
179179
return callback(null, user);
180180
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ldapauth",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"main": "./lib/ldapauth.js",
55
"description": "Authenticate against an LDAP server",
66
"author": "Trent Mick <[email protected]> (http://trentm.com)",

0 commit comments

Comments
 (0)