Prevent a user from subscribing to a deprecated plan through the API.
This commit is contained in:
parent
7e42915755
commit
3950904fb3
1 changed files with 7 additions and 3 deletions
|
@ -1537,11 +1537,15 @@ def subscribe(user, plan, token, require_business_plan):
|
|||
if plan_obj['stripeId'] == plan:
|
||||
plan_found = plan_obj
|
||||
|
||||
if not plan_found:
|
||||
if not plan_found or plan_found['deprecated']:
|
||||
logger.warning('Plan not found or deprecated: %s', plan)
|
||||
abort(404)
|
||||
|
||||
if require_business_plan and not plan_found['bus_features'] and not plan_found['price'] == 0:
|
||||
abort(404)
|
||||
if (require_business_plan and not plan_found['bus_features'] and not
|
||||
plan_found['price'] == 0):
|
||||
logger.warning('Business attempting to subscribe to personal plan: %s',
|
||||
user.username)
|
||||
abort(400)
|
||||
|
||||
private_repos = model.get_private_repo_count(user.username)
|
||||
|
||||
|
|
Reference in a new issue