From fa9e24b8092498cc423fc1fe52d1038ba76f5d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20R=C3=B6del?= Date: Wed, 24 May 2023 14:41:52 +0200 Subject: [PATCH] Disable CoderDojo form --- cgi-bin/form.py | 7 ++++--- sites/coderdojo/anmelden.md | 5 ++++- sites/coderdojo/index.md | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cgi-bin/form.py b/cgi-bin/form.py index b75ae42..abfbf19 100755 --- a/cgi-bin/form.py +++ b/cgi-bin/form.py @@ -56,14 +56,13 @@ else: # Re-sign the token, so it's fresh and the timeout doesn't waive. signed_csrf_token = serializer.dumps(csrf_token) +form_disabled = request_uri.startswith("/anmelden") match os.environ.get("REQUEST_METHOD", "").upper(): case "GET": # For GET requests, serve the form that the user requested. The CSRF # token will be added here as well. - form_disabled = False - print(f"Status: {200 if not form_disabled else 503}") print(f"Content-Type: text/html") print(f"Set-Cookie: __Host-csrftoken={signed_csrf_token}; path=/; Secure; SameSite=Strict; HttpOnly") @@ -107,9 +106,11 @@ match os.environ.get("REQUEST_METHOD", "").upper(): case _: # This case should never actually happen because lighttpd filters out - # requests accordingly. + # reprquests accordingly. fail("405 Method Not Allowed", "Method Not Allowed") +if form_disabled: + fail("503 Service Unavailable", "Form is disabled") form = cgi.FieldStorage() diff --git a/sites/coderdojo/anmelden.md b/sites/coderdojo/anmelden.md index 902f985..a1a1f08 100644 --- a/sites/coderdojo/anmelden.md +++ b/sites/coderdojo/anmelden.md @@ -4,6 +4,7 @@ useForms: true eleventyNavigation: key: Anmelden 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!" ---