minor cleanup

This commit is contained in:
Lynne Megido 2019-09-09 19:56:19 +10:00
parent 9c1a4378b3
commit 3a0c67fc4e
2 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,7 @@
{% elif session['step'] == 4 %}
<h2 class="thin centred">Congratulations!</h2>
<p>FediBooks has successfully authenticated with {{ session['instance'] }}, and your bot is ready to be configured. Click finish to return to the bot management screen.</p>
<p>FediBooks has successfully authenticated with your instance, and your bot is ready to be configured. Click finish to return to the bot management screen.</p>
<p>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 <i class="fas fa-users"></i> button. To configure settings such as posting frequency and content warnings, click the <i class="fas fa-cog"></i> button.</p>
{% else %}

View File

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