Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Added check for empty salt before attempting to encrypt password. If …
Browse files Browse the repository at this point in the history
…you sign up with OAuth provider and then try to login with Email (local strategy), the Salt is empty and authentication fails.
  • Loading branch information
andrunix committed Dec 11, 2013
1 parent 2def71a commit d3b9852
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ UserSchema.methods = {
*/
encryptPassword: function(password) {
if (!password) return '';
if (!this.salt) return '';
salt = new Buffer(this.salt, 'base64');
return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
}
Expand Down

0 comments on commit d3b9852

Please sign in to comment.