MCPcopy
hub / github.com/diegohaz/rest / update

Function update

generators/app/templates/api/password-reset/controller.js:35–48  ·  view source on GitHub ↗
({ params: { token }, bodymen: { body: { password } } }, res, next)

Source from the content-addressed store, hash-verified

33 .catch(next)
34
35export const update = ({ params: { token }, bodymen: { body: { password } } }, res, next) => {
36 return PasswordReset.findOne({ token })
37 .populate('user')
38 .then(notFound(res))
39 .then((reset) => {
40 if (!reset) return null
41 const { user } = reset
42 return user.set({ password }).save()
43 .then(() => PasswordReset.deleteMany({ user }))
44 .then(() => user.view(true))
45 })
46 .then(success(res))
47 .catch(next)
48}

Callers

nothing calls this directly

Calls 2

notFoundFunction · 0.90
successFunction · 0.90

Tested by

no test coverage detected