Here console.log(args.password) prints the hash on the console but my query returns a user object with the raw password instead the hash. Calling next(args, context, info) inside the callback has no effect!
In #123 I found a working mutation hook example so I changed the code above using bcrypt's sync function.
I would like to use bcrypt in order to encrypt user passwords. Basically bcrypt provides both synchronus and asynchronous methods to achieve this.
Regarding the performance I tried the async method inside a mutation pre hook first:
Here
console.log(args.password)
prints the hash on the console but my query returns a user object with the raw password instead the hash. Callingnext(args, context, info)
inside the callback has no effect!In #123 I found a working mutation hook example so I changed the code above using bcrypt's sync function.
Now the same query returns a user object with the hashed password.
The user object:
I can't imagine that this is intended since there could be a great demand for async hooks.
Node v4.5.0 Graffity-Mongoose v5.3.0