You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PATCH or PUT /users/:id does not encrypting the password. I think that is a bug.
As workaround I have used the follow middleware in my json server:
//Middleware for encrypt the password
server.use((req, res, next) => {
if (req.url.indexOf('users') != -1 &&
req.method === 'PATCH' || req.method === 'PUT' &&
req.body.password) {
bcrypt
.hash(req.body.password, 10)
.then((hash) => {
req.body.password = hash
next()
})
.catch(next)
}else{
next() // Simply continue with json-server router
return
}
})
Code for this is in TODO comment, am I right ?
from code:
/**
*/
// TODO: create new access token when password or email changes
The text was updated successfully, but these errors were encountered: