implement bot back button

This commit is contained in:
Lynne Megido 2019-09-02 15:35:02 +10:00
parent c060f8d7ca
commit 1d3f9fbc73
2 changed files with 7 additions and 1 deletions

View File

@ -40,7 +40,7 @@
<div class="container centred">
<a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a>
{% if session['step'] != 1 %}
<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button>
<a href="/bot/create/back" class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</a>
{% endif %}
{% if session['step'] < 5 %}
<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>

View File

@ -41,6 +41,7 @@ def home():
bot_users = {}
for bot in bots:
# multiple SELECTS is slow, maybe SELECT all at once and filter with python?
c.execute("SELECT COUNT(*) FROM `bot_learned_accounts` WHERE bot_id = %s", (bot['id'],))
bot_users[bot['id']] = c.fetchone()[0]
@ -187,6 +188,11 @@ def bot_create():
return render_template("bot_create.html")
@app.route("/bot/create/back")
def bot_create_back():
session['step'] -= 1
return redirect(url_for("bot_create"), 303)
@app.route("/do/authenticate_bot")
def do_authenticate_bot():
session['code'] = request.args.get('code')