2025-11-12 17:50:44 +01:00
|
|
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
|
|
|
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
2025-11-15 16:36:55 +01:00
|
|
|
import HomePage from './pages/HomePage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import LoginPage from './pages/LoginPage';
|
|
|
|
|
import RegisterPage from './pages/RegisterPage';
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
import VerifyEmailPage from './pages/VerifyEmailPage';
|
|
|
|
|
import ForgotPasswordPage from './pages/ForgotPasswordPage';
|
|
|
|
|
import ResetPasswordPage from './pages/ResetPasswordPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import EventsPage from './pages/EventsPage';
|
|
|
|
|
import EventChatPage from './pages/EventChatPage';
|
2025-11-14 14:11:24 +01:00
|
|
|
import EventDetailsPage from './pages/EventDetailsPage';
|
|
|
|
|
import EventCheckinPage from './pages/EventCheckinPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import MatchChatPage from './pages/MatchChatPage';
|
2025-11-14 19:22:23 +01:00
|
|
|
import MatchesPage from './pages/MatchesPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import RatePartnerPage from './pages/RatePartnerPage';
|
|
|
|
|
import HistoryPage from './pages/HistoryPage';
|
2025-11-13 20:26:49 +01:00
|
|
|
import ProfilePage from './pages/ProfilePage';
|
2025-11-13 21:03:37 +01:00
|
|
|
import PublicProfilePage from './pages/PublicProfilePage';
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
import VerificationBanner from './components/common/VerificationBanner';
|
2025-11-12 17:50:44 +01:00
|
|
|
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
// Protected Route Component with Verification Banner
|
2025-11-12 17:50:44 +01:00
|
|
|
const ProtectedRoute = ({ children }) => {
|
|
|
|
|
const { isAuthenticated, loading } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
|
|
<div className="text-lg text-gray-600">Loading...</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return <Navigate to="/login" replace />;
|
|
|
|
|
}
|
|
|
|
|
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<VerificationBanner />
|
|
|
|
|
{children}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2025-11-12 17:50:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Public Route Component (redirect to events if already logged in)
|
|
|
|
|
const PublicRoute = ({ children }) => {
|
|
|
|
|
const { isAuthenticated, loading } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
|
|
<div className="text-lg text-gray-600">Loading...</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isAuthenticated) {
|
|
|
|
|
return <Navigate to="/events" replace />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return children;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
|
return (
|
|
|
|
|
<BrowserRouter>
|
|
|
|
|
<AuthProvider>
|
|
|
|
|
<Routes>
|
|
|
|
|
{/* Public Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/login"
|
|
|
|
|
element={
|
|
|
|
|
<PublicRoute>
|
|
|
|
|
<LoginPage />
|
|
|
|
|
</PublicRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/register"
|
|
|
|
|
element={
|
|
|
|
|
<PublicRoute>
|
|
|
|
|
<RegisterPage />
|
|
|
|
|
</PublicRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
<Route path="/verify-email" element={<VerifyEmailPage />} />
|
|
|
|
|
<Route path="/forgot-password" element={<ForgotPasswordPage />} />
|
|
|
|
|
<Route path="/reset-password" element={<ResetPasswordPage />} />
|
2025-11-12 17:50:44 +01:00
|
|
|
|
|
|
|
|
{/* Protected Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/events"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
2025-11-13 21:43:58 +01:00
|
|
|
path="/events/:slug/chat"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventChatPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-14 14:11:24 +01:00
|
|
|
<Route
|
|
|
|
|
path="/events/:slug/details"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventDetailsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/events/checkin/:token"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventCheckinPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-14 19:22:23 +01:00
|
|
|
<Route
|
|
|
|
|
path="/matches"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<MatchesPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-12 17:50:44 +01:00
|
|
|
<Route
|
2025-11-14 22:22:11 +01:00
|
|
|
path="/matches/:slug/chat"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<MatchChatPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
2025-11-14 22:22:11 +01:00
|
|
|
path="/matches/:slug/rate"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<RatePartnerPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/history"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<HistoryPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-13 20:26:49 +01:00
|
|
|
<Route
|
|
|
|
|
path="/profile"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ProfilePage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-12 17:50:44 +01:00
|
|
|
|
2025-11-15 16:36:55 +01:00
|
|
|
{/* Public Profile - must be before home route */}
|
2025-11-13 21:03:37 +01:00
|
|
|
<Route
|
|
|
|
|
path="/:username"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<PublicProfilePage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-11-15 16:36:55 +01:00
|
|
|
{/* Home Page */}
|
|
|
|
|
<Route path="/" element={<HomePage />} />
|
2025-11-12 17:50:44 +01:00
|
|
|
</Routes>
|
|
|
|
|
</AuthProvider>
|
|
|
|
|
</BrowserRouter>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default App;
|