Skip to content

Commit

Permalink
bug getodk#930: added email property check, ensuring the correct resp…
Browse files Browse the repository at this point in the history
…onse.
  • Loading branch information
support9-anaxee committed Dec 14, 2023
1 parent 43bd8a4 commit 09c05fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/resources/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 }) =>
Expand Down

0 comments on commit 09c05fb

Please sign in to comment.