From 973732421a048f701443cfc3b1ecc8a16ec4b3ca Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Mon, 7 Jul 2014 13:37:16 -0600 Subject: [PATCH] fix(delete account): allow deleting account after they've canceled subscription, before it terminates --- src/controllers/user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);