Skip to content

Addressed bugs with bcrypt-nodejs and changed crypto.js to password.js #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RestWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var rack = require('hat').rack();
var Auth = require('./Auth');
var cache = require('./cache');
var Config = require('./Config');
var crypto = require('./crypto');
var passwordCrypto = require('./password');
var facebook = require('./facebook');
var Parse = require('parse/node');
var triggers = require('./triggers');
Expand Down Expand Up @@ -300,7 +300,7 @@ RestWrite.prototype.transformUser = function() {
if (this.query) {
this.storage['clearSessions'] = true;
}
return crypto.hash(this.data.password).then((hashedPassword) => {
return passwordCrypto.hash(this.data.password).then((hashedPassword) => {
this.data._hashed_password = hashedPassword;
delete this.data.password;
});
Expand Down
2 changes: 1 addition & 1 deletion crypto.js → password.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var bcrypt = require('bcrypt-nodejs');
// Returns a promise for a hashed password string.
function hash(password) {
return new Promise(function(fulfill, reject) {
bcrypt.hash(password, 8, function(err, hashedPassword) {
bcrypt.hash(password, null, null, function(err, hashedPassword) {
if (err) {
reject(err);
} else {
Expand Down
4 changes: 2 additions & 2 deletions spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Tests that involve sending password reset emails.

var request = require('request');
var crypto = require('../crypto');
var passwordCrypto = require('../password');

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

it('password format matches hosted parse', (done) => {
var hashed = '$2a$10$8/wZJyEuiEaobBBqzTG.jeY.XSFJd0rzaN//ososvEI4yLqI.4aie';
crypto.compare('test', hashed)
passwordCrypto.compare('test', hashed)
.then((pass) => {
expect(pass).toBe(true);
done();
Expand Down
4 changes: 2 additions & 2 deletions users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var Parse = require('parse/node').Parse;
var rack = require('hat').rack();

var Auth = require('./Auth');
var crypto = require('./crypto');
var passwordCrypto = require('./password');
var facebook = require('./facebook');
var PromiseRouter = require('./PromiseRouter');
var rest = require('./rest');
Expand Down Expand Up @@ -45,7 +45,7 @@ function handleLogIn(req) {
'Invalid username/password.');
}
user = results[0];
return crypto.compare(req.body.password, user.password);
return passwordCrypto.compare(req.body.password, user.password);
}).then((correct) => {
if (!correct) {
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND,
Expand Down