Using async SetFormatter for password field in node.js
Using async SetFormatter for password field in node.js
I would like to set my password field with a SetFormatter that will set a crypted password.
new Field('password')
.setFormatter((pass)=>{
bcript.hash(pass,12)
.then((cripted)=>{
return cripted});
}),
Since the bcript.hash method works as a promise it doesn't work.
What is the way to achieve this ?
Yaron
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Yaron,
The set formatters do not currently take account of Promises on return I'm afraid, so you'd need to use a synchronous version of bcrypt here.
Allan