Fix URL in confirmation mail
This commit is contained in:
parent
760cac56b2
commit
8143c6286f
15
app.py
15
app.py
|
@ -27,7 +27,7 @@ def home():
|
||||||
log.debug("in home")
|
log.debug("in home")
|
||||||
log.debug("session = %s", session)
|
log.debug("session = %s", session)
|
||||||
if "user" not in session:
|
if "user" not in session:
|
||||||
return redirect(url_for('register'))
|
return redirect(url_for("register", target="/"))
|
||||||
return render_template("home.html")
|
return render_template("home.html")
|
||||||
|
|
||||||
@app.route("/register", methods=["GET", "POST"])
|
@app.route("/register", methods=["GET", "POST"])
|
||||||
|
@ -54,9 +54,14 @@ def register():
|
||||||
csr.execute(
|
csr.execute(
|
||||||
"insert into bod(email, key, keychange) values(%s, %s, now())",
|
"insert into bod(email, key, keychange) values(%s, %s, now())",
|
||||||
(email_address, key,))
|
(email_address, key,))
|
||||||
confirmation_url = url_for("confirm",
|
log.debug("request.scheme = %s", request.scheme)
|
||||||
target=request.form["target"],
|
log.debug("request.server = %s", request.server)
|
||||||
key=key)
|
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)
|
send_mail(email_address, confirmation_url)
|
||||||
return render_template("wait_for_confirmation.html")
|
return render_template("wait_for_confirmation.html")
|
||||||
|
|
||||||
|
@ -73,6 +78,8 @@ def confirm():
|
||||||
@app.route("/vote/<string:key>")
|
@app.route("/vote/<string:key>")
|
||||||
def vote(key):
|
def vote(key):
|
||||||
log.debug("session = %s", session)
|
log.debug("session = %s", session)
|
||||||
|
if "user" not in session:
|
||||||
|
return redirect(url_for("register", target=request.url))
|
||||||
csr = get_cursor()
|
csr = get_cursor()
|
||||||
csr.execute("select * from meet where key = %s", (key,))
|
csr.execute("select * from meet where key = %s", (key,))
|
||||||
meet = csr.fetchone()
|
meet = csr.fetchone()
|
||||||
|
|
Loading…
Reference in New Issue