Skip to content

Commit 5216c93

Browse files
committed
Merge pull request #141 from ParsePlatform/fosco.crypto
Addressed bugs with bcrypt-nodejs and changed crypto.js to password.js
2 parents 7f01a67 + cb1079a commit 5216c93

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

RestWrite.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var rack = require('hat').rack();
99
var Auth = require('./Auth');
1010
var cache = require('./cache');
1111
var Config = require('./Config');
12-
var crypto = require('./crypto');
12+
var passwordCrypto = require('./password');
1313
var facebook = require('./facebook');
1414
var Parse = require('parse/node');
1515
var triggers = require('./triggers');
@@ -300,7 +300,7 @@ RestWrite.prototype.transformUser = function() {
300300
if (this.query) {
301301
this.storage['clearSessions'] = true;
302302
}
303-
return crypto.hash(this.data.password).then((hashedPassword) => {
303+
return passwordCrypto.hash(this.data.password).then((hashedPassword) => {
304304
this.data._hashed_password = hashedPassword;
305305
delete this.data.password;
306306
});

crypto.js renamed to password.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var bcrypt = require('bcrypt-nodejs');
55
// Returns a promise for a hashed password string.
66
function hash(password) {
77
return new Promise(function(fulfill, reject) {
8-
bcrypt.hash(password, 8, function(err, hashedPassword) {
8+
bcrypt.hash(password, null, null, function(err, hashedPassword) {
99
if (err) {
1010
reject(err);
1111
} else {

spec/ParseUser.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Tests that involve sending password reset emails.
77

88
var request = require('request');
9-
var crypto = require('../crypto');
9+
var passwordCrypto = require('../password');
1010

1111
describe('Parse.User testing', () => {
1212
it("user sign up class method", (done) => {
@@ -1560,7 +1560,7 @@ describe('Parse.User testing', () => {
15601560

15611561
it('password format matches hosted parse', (done) => {
15621562
var hashed = '$2a$10$8/wZJyEuiEaobBBqzTG.jeY.XSFJd0rzaN//ososvEI4yLqI.4aie';
1563-
crypto.compare('test', hashed)
1563+
passwordCrypto.compare('test', hashed)
15641564
.then((pass) => {
15651565
expect(pass).toBe(true);
15661566
done();

users.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Parse = require('parse/node').Parse;
55
var rack = require('hat').rack();
66

77
var Auth = require('./Auth');
8-
var crypto = require('./crypto');
8+
var passwordCrypto = require('./password');
99
var facebook = require('./facebook');
1010
var PromiseRouter = require('./PromiseRouter');
1111
var rest = require('./rest');
@@ -45,7 +45,7 @@ function handleLogIn(req) {
4545
'Invalid username/password.');
4646
}
4747
user = results[0];
48-
return crypto.compare(req.body.password, user.password);
48+
return passwordCrypto.compare(req.body.password, user.password);
4949
}).then((correct) => {
5050
if (!correct) {
5151
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND,

0 commit comments

Comments
 (0)