Skip to content

Commit 3f9f75e

Browse files
committed
fix(user.password) adds explicit SHA1 for user password encryption to resolve warning
1 parent 3a62d70 commit 3f9f75e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

templates/app/server/api/user(auth)/user.model(mongooseModels).js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,19 @@ UserSchema.methods = {
247247

248248
if(!callback) {
249249
// eslint-disable-next-line no-sync
250-
return crypto.pbkdf2Sync(password, salt, defaultIterations, defaultKeyLength)
250+
return crypto.pbkdf2Sync(password, salt, defaultIterations,
251+
defaultKeyLength, 'sha1')
251252
.toString('base64');
252253
}
253254

254-
return crypto.pbkdf2(password, salt, defaultIterations, defaultKeyLength, (err, key) => {
255-
if(err) {
256-
return callback(err);
257-
} else {
258-
return callback(null, key.toString('base64'));
259-
}
260-
});
255+
return crypto.pbkdf2(password, salt, defaultIterations, defaultKeyLength,
256+
'sha1', (err, key) => {
257+
if(err) {
258+
return callback(err);
259+
} else {
260+
return callback(null, key.toString('base64'));
261+
}
262+
});
261263
}
262264
};
263265

0 commit comments

Comments
 (0)