Security hardening: env-based config, CSRF protection, secure code generation, plus presenter management and email communications system

- Move all credentials from hardcoded to .env with python-dotenv (add .env.example template and .gitignore)
- Add CSRF token generation and validation on all state-changing requests
- Replace random.choices with secrets.choice for all secure code generation
- Add session cookie security headers (HttpOnly, Secure, SameSite)
- Add presenter management: assign/remove presenters to breakout sessions, presenter QR scanning
- Add email communications system: templates per event, custom email sending, sent email tracking
- Add staff/organizer profile pages with staff code display
- New DB tables: event_email_templates, sent_emails, user_communications
- New DB columns: staff.reminder_count/reminder_dates, breakout_session_organizers.presenter_code
- Expand English translation strings across all new features

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 20:34:48 +00:00
parent 934848b7f5
commit a3546b4c01
45 changed files with 8296 additions and 3207 deletions
+7 -276
View File
@@ -36,12 +36,12 @@
<div class="registration-form-section">
<h2>{{ 'register_as_attendee'|t }}</h2>
{% if preselected_type %}
<div style="background: #e8f4f8; border: 1px solid #b8daE3; border-radius: 5px; padding: 15px; margin-bottom: 20px;">
<p style="margin: 0;"><strong>{{ 'registration_type'|t }}:</strong> {{ preselected_type.name }}
<div class="alert alert-info">
<p class="m-0"><strong>{{ 'registration_type'|t }}:</strong> {{ preselected_type.name }}
{% if preselected_type.price and preselected_type.price > 0 %}
<span style="color: #27ae60; margin-left: 10px;">{{ preselected_type.price|format_currency }}</span>
<span class="text-success ml-2">{{ preselected_type.price|format_currency }}</span>
{% else %}
<span style="color: #7f8c8d; margin-left: 10px;">{{ 'free'|t }}</span>
<span class="text-muted ml-2">{{ 'free'|t }}</span>
{% endif %}
</p>
</div>
@@ -91,7 +91,7 @@
<div class="form-group">
<label for="password">{{ 'password'|t }}</label>
<input type="password" id="password" name="password" required minlength="6">
<input type="password" id="password" name="password" required minlength="8">
</div>
<div class="form-group">
@@ -182,275 +182,6 @@
</div>
</div>
<style>
.event-registration-page {
max-width: 900px;
margin: 0 auto;
padding: 20px;
}
.event-header {
text-align: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid #eee;
}
.event-header h1 {
color: #2c3e50;
margin-bottom: 15px;
}
.event-meta-box {
background: #f8f9fa;
padding: 15px;
border-radius: 8px;
margin-bottom: 15px;
}
.event-meta-box p {
margin: 5px 0;
}
.event-description-box {
margin-top: 15px;
color: #555;
}
.registration-content {
display: grid;
gap: 30px;
}
.registration-form-section {
background: #fff;
padding: 25px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.registration-form-section h2 {
margin-bottom: 20px;
color: #2c3e50;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: 500;
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
}
.char-count {
display: block;
text-align: right;
color: #888;
font-size: 12px;
margin-top: 4px;
}
.btn-block {
width: 100%;
padding: 12px;
margin-top: 10px;
}
.login-link {
text-align: center;
margin-top: 15px;
color: #666;
}
.breakout-sessions-section {
background: #fff;
padding: 25px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.breakout-sessions-section h2 {
margin-bottom: 10px;
color: #2c3e50;
}
.section-intro {
color: #666;
margin-bottom: 20px;
}
.session-card {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
margin-bottom: 15px;
background: #f8f9fa;
border-radius: 8px;
border-left: 4px solid #3498db;
}
.session-info {
flex: 1;
}
.session-info h3 {
margin: 0 0 10px 0;
color: #2c3e50;
}
.session-info p {
margin: 5px 0;
color: #555;
}
.session-actions {
margin-left: 20px;
}
.full-label {
background: #e74c3c;
color: white;
padding: 8px 15px;
border-radius: 5px;
font-size: 14px;
}
.no-sessions {
text-align: center;
color: #888;
padding: 30px;
}
.registration-complete {
margin-top: 30px;
padding: 20px;
background: #d4edda;
border-radius: 8px;
text-align: center;
}
.registration-complete p {
margin-bottom: 15px;
}
.registration-complete a {
display: inline-block;
}
.breakout-sessions-selection {
margin-top: 25px;
padding-top: 20px;
border-top: 2px solid #eee;
}
.breakout-sessions-selection > label {
font-size: 18px;
color: #2c3e50;
margin-bottom: 5px;
}
.selection-hint {
color: #666;
font-size: 14px;
margin-bottom: 15px;
}
.sessions-checkboxes {
display: grid;
gap: 10px;
max-height: 400px;
overflow-y: auto;
padding: 10px;
background: #f8f9fa;
border-radius: 8px;
}
.session-checkbox-item {
display: flex;
align-items: flex-start;
padding: 12px;
background: #fff;
border-radius: 6px;
border: 1px solid #e0e0e0;
transition: all 0.2s;
}
.session-checkbox-item:hover {
border-color: #3498db;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.session-checkbox-item.session-full {
opacity: 0.6;
background: #f5f5f5;
}
.session-checkbox-item input[type="checkbox"] {
width: 20px;
height: 20px;
margin-right: 12px;
margin-top: 4px;
cursor: pointer;
}
.session-checkbox-item input[type="checkbox"]:disabled {
cursor: not-allowed;
}
.session-checkbox-item label {
flex: 1;
cursor: pointer;
margin: 0;
}
.session-checkbox-item label strong {
display: block;
color: #2c3e50;
margin-bottom: 5px;
}
.session-checkbox-item label span {
display: block;
font-size: 13px;
color: #666;
}
.session-checkbox-item label .session-time {
color: #3498db;
font-weight: 500;
}
.session-checkbox-item label .session-location {
color: #888;
}
.session-checkbox-item label .session-capacity {
margin-top: 5px;
font-weight: 500;
}
.session-checkbox-item label .session-capacity.full {
color: #e74c3c;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
var intro = document.getElementById('introduction');
@@ -477,10 +208,10 @@ document.querySelectorAll('.rsvp-btn').forEach(btn => {
if (data.success) {
location.reload();
} else {
alert(data.error || '{{ "error_occurred"|t }}');
showToast(data.error || '{{ "error_occurred"|t }}', 'error');
}
} catch (error) {
alert('{{ "error_processing_request"|t }}');
showToast('{{ "error_processing_request"|t }}', 'error');
}
});
});