config: add REGISTRATIONS config check in register bp

This commit is contained in:
Luna Mendes 2018-11-16 16:48:32 -03:00
parent 2f972fc735
commit 109a56db4c
2 changed files with 5 additions and 0 deletions

View File

@ -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']

View File

@ -97,4 +97,5 @@ async def payment_job(app):
except Exception:
log.exception('error while processing user payments')
log.debug('rescheduling..')
await _resched(app)