mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
parent
8a43f29bc4
commit
81e41a2f2d
1 changed files with 15 additions and 0 deletions
|
|
@ -38,6 +38,17 @@ HONEYPOT_FIELD_NAME = "addressline1"
|
|||
# isn't all too strict.
|
||||
EMAIL_REGEX = re.compile(r"^[^ ]+@[^ ]+\.[^ ]+$")
|
||||
|
||||
# Mapping from site-defined devices (see sites/angestoepselt/_data/config.json in this
|
||||
# repository) to the corresponding Zammad categories:
|
||||
# https://codeberg.org/angestoepselt/homepage/issues/120#issuecomment-1727768
|
||||
# This is a (str | int) -> str map because some keys we check against below might be
|
||||
# integers and it's just easier to type this way.
|
||||
FORM_CATEGORY_MAP: dict[str | int, str] = {
|
||||
"Laptop": "laptop",
|
||||
"Laptop ohne Akku": "laptop-battery-missing",
|
||||
"Desktop-Computer": "desktop",
|
||||
}
|
||||
|
||||
SITE_DIRECTORY = os.environ.get("SITE_DIRECTORY", "")
|
||||
request_uri = os.environ.get("REQUEST_URI", "").lower().rstrip("/")
|
||||
serializer = itsdangerous.URLSafeSerializer("secret key", "salt")
|
||||
|
|
@ -204,6 +215,7 @@ ticket_details["Kontaktperson"] = contact_name
|
|||
ticket_details["Email"] = contact_email
|
||||
|
||||
form_group = "csw-Allgemein"
|
||||
form_category: str | None = None
|
||||
|
||||
match request_uri:
|
||||
case "/kontakt":
|
||||
|
|
@ -232,7 +244,10 @@ match request_uri:
|
|||
case "/computer-beantragen/privat":
|
||||
form_name = "Computerantrag (privat)"
|
||||
form_group = "csw-Anfragen"
|
||||
|
||||
ticket_details["Gewünschte Hardware"] = get_form_value("hardware", default="Unbekannt")
|
||||
form_category = FORM_CATEGORY_MAP.get(ticket_details["Gewünschte Hardware"], None)
|
||||
|
||||
ticket_details["Adresse"] = get_form_value("addressline")
|
||||
ticket_details["PLZ"] = get_form_value("postalcode")
|
||||
ticket_details["Stadt"] = get_form_value("city")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue