Revert "Disable CoderDojo form"

This reverts commit fa9e24b809.
This commit is contained in:
Yannik Rödel 2023-05-26 10:36:35 +02:00
parent fa9e24b809
commit e37b50f1f4
3 changed files with 5 additions and 9 deletions

View file

@ -56,13 +56,14 @@ else:
# Re-sign the token, so it's fresh and the timeout doesn't waive. # Re-sign the token, so it's fresh and the timeout doesn't waive.
signed_csrf_token = serializer.dumps(csrf_token) signed_csrf_token = serializer.dumps(csrf_token)
form_disabled = request_uri.startswith("/anmelden")
match os.environ.get("REQUEST_METHOD", "").upper(): match os.environ.get("REQUEST_METHOD", "").upper():
case "GET": case "GET":
# For GET requests, serve the form that the user requested. The CSRF # For GET requests, serve the form that the user requested. The CSRF
# token will be added here as well. # token will be added here as well.
form_disabled = False
print(f"Status: {200 if not form_disabled else 503}") print(f"Status: {200 if not form_disabled else 503}")
print(f"Content-Type: text/html") print(f"Content-Type: text/html")
print(f"Set-Cookie: __Host-csrftoken={signed_csrf_token}; path=/; Secure; SameSite=Strict; HttpOnly") print(f"Set-Cookie: __Host-csrftoken={signed_csrf_token}; path=/; Secure; SameSite=Strict; HttpOnly")
@ -106,11 +107,9 @@ match os.environ.get("REQUEST_METHOD", "").upper():
case _: case _:
# This case should never actually happen because lighttpd filters out # This case should never actually happen because lighttpd filters out
# reprquests accordingly. # requests accordingly.
fail("405 Method Not Allowed", "Method Not Allowed") fail("405 Method Not Allowed", "Method Not Allowed")
if form_disabled:
fail("503 Service Unavailable", "Form is disabled")
form = cgi.FieldStorage() form = cgi.FieldStorage()

View file

@ -4,7 +4,6 @@ useForms: true
eleventyNavigation: eleventyNavigation:
key: Anmelden key: Anmelden
order: 20 order: 20
callout: "Diese Veranstaltung ist bereits ausgebucht. Vielleicht können wir aber die Kapazitäten noch erhöhen; schau doch einfach in ein paar Wochen nochmal vorbei!"
--- ---
<style> <style>
@ -36,8 +35,7 @@ Hier findest du schon mal die Details zur kommenden Veranstaltung:
Schon jetzt wollen wir uns herzlich bei der Montesorri-Schule Würzburg bedanken, die zum ersten Mal ein CoderDojo in Würzburg mit uns ausrichten! Schon jetzt wollen wir uns herzlich bei der Montesorri-Schule Würzburg bedanken, die zum ersten Mal ein CoderDojo in Würzburg mit uns ausrichten!
<form class="blanked-out-form" method="post" action="/anmelden"> <form method="post" action="/anmelden">
<fieldset disabled="disabled">
<input type="hidden" name="veranstaltung" value="06. Mai 2023" /> <input type="hidden" name="veranstaltung" value="06. Mai 2023" />
@ -115,5 +113,4 @@ Wir versuchen unser Bestes, aber wir können keine Leihgeräte garantieren.
<input type="submit" value="Anmeldung abschicken" /> <input type="submit" value="Anmeldung abschicken" />
</div> </div>
</fieldset>
</form> </form>

View file

@ -23,7 +23,7 @@ Kostenlose Programmier- und Techniktreffen für Kinder und Jugendliche im Raum W
<a href="/anmelden"> <a href="/anmelden">
<h3>Jetzt anmelden</h3> <h3>Jetzt anmelden</h3>
<em class="inline-callout">Ausgebucht</em> <em class="inline-callout">Sa. 24.06.23 @ Montessori-Schule</em>
</a> </a>
<a href="https://mailing.angestoepselt.de/subscription/form" target="_blank"> <a href="https://mailing.angestoepselt.de/subscription/form" target="_blank">