Open ktmud opened 10 years ago
I want to do something like:
var Passport = db.define('passport', { password: String, // password hashed }) Passport.validatesLengthOf('password', {min: 6}); Passport.afterValidate = function() { this.password = Passport.hash(this.password) }
But actually, I have to do
Passport.afterValidate = function(next, data) { data.password = Passport.hash(data.password) next() }
This is not well documented, and it takes me quite a while to figure out what's going on.
I'm just curious, why not just allow people to set instance attribute directly, instead of passing data round and round?
data
Oh, wait, I cannot do the later, either, since data is not passed to afterHooks...
I want to do something like:
But actually, I have to do
This is not well documented, and it takes me quite a while to figure out what's going on.
I'm just curious, why not just allow people to set instance attribute directly, instead of passing
data
round and round?