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

Commit d3b9852

Browse files
committed
Added check for empty salt before attempting to encrypt password. If you sign up with OAuth provider and then try to login with Email (local strategy), the Salt is empty and authentication fails.
1 parent 2def71a commit d3b9852

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/models/user.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ UserSchema.methods = {
117117
*/
118118
encryptPassword: function(password) {
119119
if (!password) return '';
120+
if (!this.salt) return '';
120121
salt = new Buffer(this.salt, 'base64');
121122
return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
122123
}

0 commit comments

Comments
 (0)