fix delete endpoint

This commit is contained in:
Tim Alby 2018-06-26 19:50:12 +02:00
parent 3e0ad47873
commit 60009c6346
3 changed files with 5 additions and 5 deletions

View file

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

View file

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

View file

@ -78,9 +78,9 @@ define [
} }
removeUserEmail = (email) -> removeUserEmail = (email) ->
$http.delete "/user/emails/#{ encodeURIComponent(email) }", { $http.post "/user/emails/delete", {
headers: email,
"X-CSRF-Token": window.csrfToken _csrf: window.csrfToken
} }
isDomainBlacklisted = (domain) -> isDomainBlacklisted = (domain) ->