Do not succeed if mailbox name is already taken

This commit is contained in:
Johannes Zellner
2018-04-06 16:51:37 +02:00
parent 878940edae
commit 55d53ef311
2 changed files with 2 additions and 2 deletions

View File

@@ -232,7 +232,7 @@ function addMailbox(req, res, next) {
mail.addMailbox(req.body.name, req.params.domain, req.body.userId, function (error) {
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error && error.reason === MailError.ALREADY_EXISTS) return next(new HttpSuccess(201, {}));
if (error && error.reason === MailError.ALREADY_EXISTS) return next(new HttpError(409, error.message));
if (error && error.reason === MailError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error) return next(new HttpError(500, error));