From 10041f97907a4bd1b7f1dbfd31ae47dbc7703fa9 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 14 Nov 2018 01:16:29 +1000 Subject: [PATCH] not smart bune --- web.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web.py b/web.py index 3273346..107c2a8 100755 --- a/web.py +++ b/web.py @@ -43,7 +43,7 @@ def db_reconnect(): c = db.cursor() dc = db.cursor(dictionary=True) return (db, c, dc) - + db, c, dc = db_reconnect() c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR(64) NOT NULL, instance VARCHAR(128) NOT NULL, password TINYTEXT NOT NULL, avi TEXT NOT NULL, secret TINYTEXT NOT NULL, client_id VARCHAR(128) NOT NULL, client_secret TINYTEXT NOT NULL, cc TINYTEXT, ccavi VARCHAR(128) DEFAULT 'https://lynnesbian.space/res/ceres/cc-smol.png', latest_post TINYTEXT, last_check INT DEFAULT 0 NOT NULL, time_between_checks INT DEFAULT %s NOT NULL, settings VARCHAR(4096) DEFAULT %s, PRIMARY KEY(username, instance))", (cfg['min_time_between_checks'], json.dumps(settings),)) db.close() @@ -190,11 +190,12 @@ def do_login(): def create_password(): db, c, dc = db_reconnect() c.execute("SELECT COUNT(*) FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance'])) - db.close() 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')) @app.route('/internal/create_account', methods=['POST'])