feat: implement reminder preferences and withdrawal (Stories 6.3, 6.2)

Implement Phase 3 participant self-management features:

Story 6.3 - Reminder Preferences:
- Add ReminderPreferenceForm to participant forms
- Add update_preferences route for preference updates
- Update dashboard template with reminder preference toggle
- Participants can enable/disable reminder emails at any time

Story 6.2 - Withdrawal from Exchange:
- Add can_withdraw utility function for state validation
- Create WithdrawalService to handle withdrawal process
- Add WithdrawForm with explicit confirmation requirement
- Add withdraw route with GET (confirmation) and POST (process)
- Add withdrawal confirmation email template
- Update dashboard to show withdraw link when allowed
- Withdrawal only allowed before registration closes
- Session cleared after withdrawal, user redirected to registration

All acceptance criteria met for both stories.
Test coverage: 90.02% (156 tests passing)
Linting and type checking: passed

🤖 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 21:18:18 -07:00
co-authored by Claude Opus 4.5
parent 4fbb681e03
commit c2b3641d74
12 changed files with 725 additions and 2 deletions
+24 -1
View File
@@ -1,7 +1,7 @@
"""Forms for participant registration and management."""
from flask_wtf import FlaskForm
from wtforms import BooleanField, EmailField, StringField, TextAreaField
from wtforms import BooleanField, EmailField, StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, Email, Length
@@ -70,3 +70,26 @@ class ProfileUpdateForm(FlaskForm):
description="Optional wishlist or gift preferences for your Secret Santa",
render_kw={"rows": 6, "maxlength": 10000},
)
class ReminderPreferenceForm(FlaskForm):
"""Form for updating reminder email preferences."""
reminder_enabled = BooleanField(
"Send me reminder emails before the exchange date",
description="You can change this at any time",
)
class WithdrawForm(FlaskForm):
"""Form for confirming withdrawal from exchange.
Requires explicit confirmation to prevent accidental withdrawals.
"""
confirm = BooleanField(
"I understand this cannot be undone and I will need to re-register to rejoin",
validators=[DataRequired(message="You must confirm to withdraw")],
)
submit = SubmitField("Withdraw from Exchange")