feat: implement Story 4.2 - New Participant Registration

Implement participant registration with the following features:

- POST handler for /exchange/<slug>/register
- Create Participant record with lowercased email
- Generate magic token and send confirmation email
- Redirect to success page after registration
- Rate limiting: 10 registrations per hour per IP
- Validation for exchange state (must be registration_open)
- Form validation for required fields (name, email)
- Email format validation
- Optional fields support (gift_ideas, reminder_enabled)

Also includes:
- Registration success page template
- 429 error handling template
- Flash message support in base template
- Test config update for email service dev mode
- Comprehensive test suite with 8 tests

All tests passing (86 total), 91% coverage maintained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 17:14:11 -07:00
co-authored by Claude Opus 4.5
parent 81e2cb8c86
commit 3467d97828
8 changed files with 506 additions and 6 deletions
+2 -4
View File
@@ -112,10 +112,7 @@ def register_error_handlers(app: Flask) -> None:
@app.errorhandler(429)
def rate_limit_error(_error):
"""Handle 429 Too Many Requests errors."""
from flask import flash, redirect, request
flash("Too many attempts. Please try again later.", "error")
return redirect(request.referrer or "/"), 429
return render_template("errors/429.html"), 429
def register_setup_check(app: Flask) -> None:
@@ -140,6 +137,7 @@ def register_setup_check(app: Flask) -> None:
"static",
"health",
"participant.register",
"participant.register_success",
"participant.request_access",
"participant.magic_login",
"participant.dashboard",