Skip to content

Commit b469ea8

Browse files
committed
require a click at /confirm, refer to /redeem
1 parent 02d149c commit b469ea8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

fsfe_forms/app.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from fsfe_forms import config
2323
from fsfe_forms.email import init_email
24-
from fsfe_forms.views import confirm, email, index
24+
from fsfe_forms.views import confirm, email, index, redeem
2525

2626

2727
# =============================================================================
@@ -84,5 +84,6 @@ def create_app():
8484
app.add_url_rule(rule="/", view_func=index)
8585
app.add_url_rule(rule="/email", view_func=email, methods=["GET", "POST"])
8686
app.add_url_rule(rule="/confirm", view_func=confirm)
87+
app.add_url_rule(rule="/redeem", view_func=redeem)
8788

8889
return app

fsfe_forms/templates/confirm.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<title>FSFE Form Server</title>
3+
<h1>FSFE Form Server</h1>
4+
<form action="/redeem" method="GET">
5+
<input type="hidden" name="id" value="{{ id }}" />
6+
<button type="submit">Confirm</button>
7+
</form>

fsfe_forms/views.py

+7
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ def email():
181181

182182
@use_kwargs(confirm_parameters, location="query")
183183
def confirm(id):
184+
"""A landing page to confirm the ID via a click. Hands over to redeem()"""
185+
return render_template("confirm.html", id=id)
186+
187+
188+
@use_kwargs(confirm_parameters, location="query")
189+
def redeem(id):
190+
"""Redeems an ID after checking its validity, refers to further actions then"""
184191
params = queue_pop(id)
185192

186193
app_config = _find_app_config(params["appid"])

0 commit comments

Comments
 (0)