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()