diff --git a/lib/resources/users.js b/lib/resources/users.js index 468ff3990..45507b489 100644 --- a/lib/resources/users.js +++ b/lib/resources/users.js @@ -55,7 +55,7 @@ module.exports = (service, endpoint) => { // TODO/SECURITY: subtle timing attack here. service.post('/users/reset/initiate', endpoint(({ Users, mail }, { auth, body, query }) => - Users.getByEmail(body.email) + (!body.email ? Problem.user.propertyNotFound({ property: 'email' }) : Users.getByEmail(body.email) .then((maybeUser) => maybeUser .map((user) => ((isTrue(query.invalidate)) ? auth.canOrReject('user.password.invalidate', user.actor) @@ -70,7 +70,7 @@ module.exports = (service, endpoint) => { .then((existed) => ((existed === true) ? mail(body.email, 'accountResetDeleted') : resolve())))) - .then(success)))); + .then(success))))); // TODO: some standard URL structure for RPC-style methods. service.post('/users/reset/verify', endpoint(({ Actors, Sessions, Users }, { body, auth }) =>