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)