Add server-side input validation

- Validate that first_name, last_name, email, and location are provided
- Add regex-based email format validation in app.py
- Display error messages on the guestbook form if validation fails

These changes help ensure that only properly formatted data is stored.
This commit is contained in:
Steve Dogiakos
2025-04-01 18:01:58 -06:00
parent e18fd5fffa
commit 83775b716f
2 changed files with 40 additions and 13 deletions

View File

@@ -8,6 +8,9 @@
<body>
<h1>Museum Visitor Guestbook</h1>
{% if error %}
<div style="color: red;">{{ error }}</div>
{% endif %}
<form method="post" action="/">
<label for="first_name">First Name(s):</label><br>
<input type="text" id="first_name" name="first_name" required><br><br>