I absolutely agree. An even better structure wouldn’t have a raw password field on the user object at all.
I absolutely agree. An even better structure wouldn’t have a raw password field on the user object at all.
In addition to the excellent points made by steventhedev and koper:
user.password = await hashPassword(user.password);
Just this one line of code alone is wrong.
Mostly, they don’t