Read user email from the URL in DELETE requests.

This commit is contained in:
Paulo Reis 2018-06-21 17:16:42 +01:00
parent 147d74d92a
commit b16ebc1843
2 changed files with 3 additions and 2 deletions

View file

@ -25,7 +25,8 @@ module.exports = UserEmailsController =
remove: (req, res) ->
userId = AuthenticationController.getLoggedInUserId(req)
email = EmailHelper.parseEmail(req.body.email)
logger.log req.params
email = EmailHelper.parseEmail(req.params.email)
return res.sendStatus 422 unless email?
UserUpdater.removeEmailAddress userId, email, (error)->

View file

@ -114,7 +114,7 @@ module.exports = class Router
webRouter.post '/user/emails',
AuthenticationController.requireLogin(),
UserEmailsController.add
webRouter.delete '/user/emails',
webRouter.delete '/user/emails/:email',
AuthenticationController.requireLogin(),
UserEmailsController.remove
webRouter.post '/user/emails/default',