From e66729485e493e2027b5526d9ff060ded89cf4d3 Mon Sep 17 00:00:00 2001 From: pluja Date: Fri, 4 Sep 2020 17:07:44 +0200 Subject: [PATCH] Fix closed registrations logic --- app/routes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/routes.py b/app/routes.py index 0f249ac..2f58d96 100644 --- a/app/routes.py +++ b/app/routes.py @@ -32,7 +32,6 @@ config = json.load(open('yotter-config.json')) ########################## NITTERINSTANCE = config['nitterInstance'] # Must be https://.../ YOUTUBERSS = "https://www.youtube.com/feeds/videos.xml?channel_id=" -REGISTRATIONS = config['registrations'] ########################## #### Global variables #### @@ -487,12 +486,12 @@ def allowed_file(filename): @app.route('/register', methods=['GET', 'POST']) def register(): - global REGISTRATIONS count = db.session.query(User).count() if current_user.is_authenticated: return redirect(url_for('index')) - if count >= config['maxInstanceUsers']: + REGISTRATIONS = True + if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0: REGISTRATIONS = False form = RegistrationForm() @@ -501,7 +500,6 @@ def register(): flash("This username is taken! Try with another.") return redirect(request.referrer) - user = User(username=form.username.data) user.set_password(form.password.data) db.session.add(user)