added gross hack

This commit is contained in:
Lynne Megido 2018-11-14 01:27:14 +10:00
parent 068306944c
commit 0dd8efccff
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499

14
web.py
View file

@ -190,13 +190,17 @@ def do_login():
def create_password(): def create_password():
db, c, dc = db_reconnect() db, c, dc = db_reconnect()
c.execute("SELECT COUNT(*) FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance'])) c.execute("SELECT COUNT(*) FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance']))
if c.fetchone()[0] == 0: try: #TODO: this is a disgusting hack, REMOVE IT
if c.fetchone()[0] == 0:
db.close()
return render_template("create_password.html", bg = "background-image:url('{}')".format(session['avi']))
else:
#user already exists in database, so they already have a password
db.close()
return redirect(url_for('main'))
except:
db.close() db.close()
return render_template("create_password.html", bg = "background-image:url('{}')".format(session['avi'])) return render_template("create_password.html", bg = "background-image:url('{}')".format(session['avi']))
else:
#user already exists in database, so they already have a password
db.close()
return redirect(url_for('main'))
@app.route('/internal/create_account', methods=['POST']) @app.route('/internal/create_account', methods=['POST'])
def create_account(): def create_account():