diff --git a/src/controllers/user.js b/src/controllers/user.js index 5242319ff1..b43f259240 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -258,7 +258,8 @@ api.cron = function(req, res, next) { // api.reset // Shared.ops api['delete'] = function(req, res, next) { - if (res.locals.user.purchased.plan.customerId) + var plan = res.locals.user.purchased.plan; + if (plan && plan.customerId && !plan.dateTerminated) return res.json(400,{err:"You have an active subscription, cancel your plan before deleting your account."}); res.locals.user.remove(function(err){ if (err) return next(err);