-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Description
This is important for anyone using bcrypt, including mongoose-auth, which currently relies on synchronous bcrypt functions, which block the entire server while they work.
schema.virtual('password').get( function () {
return this._password;
}).set( function (password) {
this._password = password;
var salt = this.salt = bcrypt.gen_salt_sync(10);
this.hash = bcrypt.encrypt_sync(password, salt);
});versus the asynchronous form
schema.virtual('password').get( function () {
return this._password;
}).set( function (password, done) {
var _this = this;
bcrypt.gen_salt(10, function(err, salt) {
bcrypt.encrypt(password, salt, function(err, hash) {
_this._password = password;
_this.salt = salt;
done();
});
});
});(speaking of which, that is an awful authentication module, at least in the password-auth department — I know I wouldn't trust it.)
u-ways and DimaCrafter
Metadata
Metadata
Assignees
Labels
No labels