From 109a56db4c87db3e3147890e18626279907256d8 Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Fri, 16 Nov 2018 16:48:32 -0300 Subject: [PATCH] config: add REGISTRATIONS config check in register bp --- litecord/blueprints/auth.py | 4 ++++ litecord/blueprints/user/billing_job.py | 1 + 2 files changed, 5 insertions(+) diff --git a/litecord/blueprints/auth.py b/litecord/blueprints/auth.py index 454c4bb..8936c4c 100644 --- a/litecord/blueprints/auth.py +++ b/litecord/blueprints/auth.py @@ -31,6 +31,10 @@ def make_token(user_id, user_pwd_hash) -> str: @bp.route('/register', methods=['POST']) async def register(): """Register a single user.""" + enabled = app.config.get('REGISTRATIONS') + if not enabled: + return 'Registrations disabled', 405 + j = await request.get_json() email, password, username = j['email'], j['password'], j['username'] diff --git a/litecord/blueprints/user/billing_job.py b/litecord/blueprints/user/billing_job.py index ff6f0d0..d33b181 100644 --- a/litecord/blueprints/user/billing_job.py +++ b/litecord/blueprints/user/billing_job.py @@ -97,4 +97,5 @@ async def payment_job(app): except Exception: log.exception('error while processing user payments') + log.debug('rescheduling..') await _resched(app)