From 760cac56b2f4bc32cf3b9f955a4a8bb13df1964c Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 5 Nov 2022 11:47:22 +0100 Subject: [PATCH 1/5] Fix requirements --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d598ec8..7896ff1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask -procrusql +procrusql >= 0.0.10 psycopg psycopg2 +gunicorn From 8143c6286f52e02ef25b48f925f907cf5f1ada11 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 5 Nov 2022 11:47:46 +0100 Subject: [PATCH 2/5] Fix URL in confirmation mail --- app.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 9d38e8a..4ca5026 100644 --- a/app.py +++ b/app.py @@ -27,7 +27,7 @@ def home(): log.debug("in home") log.debug("session = %s", session) if "user" not in session: - return redirect(url_for('register')) + return redirect(url_for("register", target="/")) return render_template("home.html") @app.route("/register", methods=["GET", "POST"]) @@ -54,9 +54,14 @@ def register(): csr.execute( "insert into bod(email, key, keychange) values(%s, %s, now())", (email_address, key,)) - confirmation_url = url_for("confirm", - target=request.form["target"], - key=key) + log.debug("request.scheme = %s", request.scheme) + log.debug("request.server = %s", request.server) + log.debug("request.root_url = %s", request.root_url) + confirmation_url = \ + request.root_url + \ + url_for("confirm", + target=request.form["target"], + key=key) send_mail(email_address, confirmation_url) return render_template("wait_for_confirmation.html") @@ -73,6 +78,8 @@ def confirm(): @app.route("/vote/") def vote(key): log.debug("session = %s", session) + if "user" not in session: + return redirect(url_for("register", target=request.url)) csr = get_cursor() csr.execute("select * from meet where key = %s", (key,)) meet = csr.fetchone() From 93730d95fbce05b53351310250a1e6009d523353 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 5 Nov 2022 12:09:00 +0100 Subject: [PATCH 3/5] Fix vote update --- app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 4ca5026..0d35a72 100644 --- a/app.py +++ b/app.py @@ -133,7 +133,9 @@ def vote_date(): abort(400) meet_id = r[0].meet - csr.execute("delete from date_vote where date = any (%s)", (date_ids,)) + csr.execute( + "delete from date_vote where date = any (%s) and bod = %s", + (date_ids, session["user"]["id"])) for pos, date_id in enumerate(date_ids): csr.execute( "insert into date_vote(date, bod, position) values(%s, %s, %s)", @@ -167,7 +169,9 @@ def vote_time(): abort(400) meet_id = r[0].meet - csr.execute("delete from time_vote where time = any (%s)", (time_ids,)) + csr.execute( + "delete from time_vote where time = any (%s) and bod = %s", + (time_ids, session["user"]["id"])) for pos, time_id in enumerate(time_ids): csr.execute( "insert into time_vote(time, bod, position) values(%s, %s, %s)", @@ -201,7 +205,9 @@ def vote_place(): abort(400) meet_id = r[0].meet - csr.execute("delete from place_vote where place = any (%s)", (place_ids,)) + csr.execute( + "delete from place_vote where place = any (%s) and bod = %s", + (place_ids, session["user"]["id"])) for pos, place_id in enumerate(place_ids): csr.execute( "insert into place_vote(place, bod, position) values(%s, %s, %s)", From 0877d7678fbd59a9289858947f4bfb4d343d3ef9 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Mon, 7 Nov 2022 21:40:20 +0100 Subject: [PATCH 4/5] Make blue-background-class true ;-) --- static/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/style.css b/static/style.css index a44c886..dd12f00 100644 --- a/static/style.css +++ b/static/style.css @@ -11,3 +11,7 @@ body { border: #CCC 1px solid; border-radius: 0.2em; } + +.blue-background-class { + background: #CDF; +} From e21caec1e2806114890cd3a86e1830cf5343cba4 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Mon, 7 Nov 2022 21:41:17 +0100 Subject: [PATCH 5/5] Activate sortables only once --- templates/vote.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/vote.html b/templates/vote.html index 0813e86..83c3038 100644 --- a/templates/vote.html +++ b/templates/vote.html @@ -47,7 +47,7 @@