From 3a0c67fc4e77ac69b8eb9d3a5c235c1d94af9fa4 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 9 Sep 2019 19:56:19 +1000 Subject: [PATCH] minor cleanup --- templates/bot_create.html | 2 +- webui.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/bot_create.html b/templates/bot_create.html index 0175243..190775c 100644 --- a/templates/bot_create.html +++ b/templates/bot_create.html @@ -30,7 +30,7 @@ {% elif session['step'] == 4 %}

Congratulations!

-

FediBooks has successfully authenticated with {{ session['instance'] }}, and your bot is ready to be configured. Click finish to return to the bot management screen.

+

FediBooks has successfully authenticated with your instance, and your bot is ready to be configured. Click finish to return to the bot management screen.

To get your bot working, you need to add at least one account for it to learn from. You can do so by clicking the button. To configure settings such as posting frequency and content warnings, click the button.

{% else %} diff --git a/webui.py b/webui.py index 85730f9..c51dac5 100644 --- a/webui.py +++ b/webui.py @@ -20,6 +20,13 @@ mysql = MySQL(app) scopes = ['write:statuses', 'write:accounts', 'read:accounts', 'read:notifications', 'read:statuses', 'push'] +@app.before_request +def login_check(): + if request.path not in ['/', '/about', '/welcome', '/login', '/signup', '/do/login', '/do/signup', '/static/style.css']: + # page requires authentication + if 'user_id' not in session: + return redirect(url_for('home')) + @app.route("/") def home(): if 'user_id' in session: @@ -408,10 +415,3 @@ def bot_check(bot): c = mysql.connection.cursor() c.execute("SELECT COUNT(*) FROM `bots` WHERE `handle` = %s AND `user_id` = %s", (bot, session['user_id'])) return c.fetchone()[0] == 1 - -@app.before_request -def login_check(): - if request.path not in ['/', '/about', '/welcome', '/login', '/signup', '/do/login', '/do/signup', '/static/style.css']: - # page requires authentication - if 'user_id' not in session: - return redirect(url_for('home'))