Check for plan when enabling email

This commit is contained in:
Johannes Zellner
2018-05-29 13:31:40 +02:00
parent 99be89012d
commit 9eb58cdfe5
2 changed files with 25 additions and 14 deletions

View File

@@ -182,6 +182,7 @@ function setMailEnabled(req, res, next) {
mail.setMailEnabled(req.params.domain, !!req.body.enabled, function (error) {
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error && error.reason === MailError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error && error.reason === MailError.BILLING_REQUIRED) return next(new HttpError(402, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(202));