mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-11-25 08:38:59 +00:00
remove leading/trailing whitespace from account @ in bot accounts add page
This commit is contained in:
parent
5def1f2fe6
commit
8469b73c3c
1 changed files with 6 additions and 5 deletions
|
@ -5,13 +5,15 @@ import re, json
|
|||
|
||||
def bot_accounts_add(mysql, cfg):
|
||||
if request.method == 'POST':
|
||||
# remove leading/trailing whitespace
|
||||
session['handle'] = request.form['account'].rstrip().lstrip()
|
||||
if session['step'] == 1:
|
||||
if request.form['account'] == session['bot']:
|
||||
if session['handle'] == session['bot']:
|
||||
error = "Bots cannot learn from themselves."
|
||||
return render_template("bot/accounts_add.html", error = error)
|
||||
|
||||
# look up user
|
||||
handle_list = request.form['account'].split('@')
|
||||
handle_list = session['handle'].split('@')
|
||||
if len(handle_list) != 3:
|
||||
# not formatted correctly
|
||||
error = "Incorrectly formatted handle."
|
||||
|
@ -19,7 +21,6 @@ def bot_accounts_add(mysql, cfg):
|
|||
|
||||
session['username'] = handle_list[1]
|
||||
session['instance'] = handle_list[2]
|
||||
session['handle'] = request.form['account']
|
||||
|
||||
if session['instance'] in json.load(open("blacklist.json")):
|
||||
session['error'] = "Learning from accounts on this instance is not allowed."
|
||||
|
|
Loading…
Reference in a new issue