/** * Email Verification Required Page * * Displayed when a user needs to verify their email address before accessing the application. * Provides options to resend verification email and log out. */ import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useCurrentUser } from '../hooks/useAuth'; import apiClient from '../api/client'; import { useLogout } from '../hooks/useAuth'; const EmailVerificationRequired: React.FC = () => { const { t } = useTranslation(); const { data: user } = useCurrentUser(); const logoutMutation = useLogout(); const [sending, setSending] = useState(false); const [sent, setSent] = useState(false); const [error, setError] = useState(null); const handleResendEmail = async () => { setSending(true); setError(null); setSent(false); try { await apiClient.post('/api/auth/email/verify/send/'); setSent(true); setTimeout(() => setSent(false), 5000); // Hide success message after 5 seconds } catch (err: any) { setError(err.response?.data?.detail || 'Failed to send verification email'); } finally { setSending(false); } }; const handleLogout = () => { logoutMutation.mutate(); }; return (
{/* Icon */}
{/* Title */}

Email Verification Required

{/* Message */}

Please verify your email address to access your account.

{/* Email Display */}

Verification email sent to:

{user?.email}

{/* Instructions */}

Check your inbox for a verification email and click the link to verify your account. Don't forget to check your spam folder if you don't see it.

{/* Success Message */} {sent && (

Verification email sent successfully! Check your inbox.

)} {/* Error Message */} {error && (

{error}

)} {/* Actions */}
{/* Resend Email Button */} {/* Logout Button */}
{/* Help Text */}

Need help? Contact support at{' '} support@smoothschedule.com

); }; export default EmailVerificationRequired;