fix: AWS SES configuration and email verification flow

Changes:
- Updated AWS_REGION to eu-central-1 in env examples
- Fixed email verification to return new JWT token with updated emailVerified status
- Added updateUser function to AuthContext for token refresh
- Updated frontend to save new token after email verification
- Fixed variable naming conflict (token vs jwtToken) in verification endpoints
- Changed WSDC ID placeholder from 26997 to 12345

This ensures the verification banner disappears immediately after
email verification without requiring re-login.
This commit is contained in:
Radosław Gierwiało
2025-11-13 18:59:28 +01:00
parent 3ff966defc
commit 27ee0ae365
5 changed files with 43 additions and 5 deletions

View File

@@ -195,7 +195,7 @@ const RegisterPage = () => {
value={wsdcId}
onChange={(e) => setWsdcId(e.target.value.replace(/\D/g, ''))}
className="pl-10 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500"
placeholder="26997"
placeholder="12345"
maxLength={10}
/>
{wsdcLoading && (

View File

@@ -1,11 +1,13 @@
import { useState, useEffect } from 'react';
import { useNavigate, useSearchParams, Link } from 'react-router-dom';
import { authAPI } from '../services/api';
import { useAuth } from '../contexts/AuthContext';
import { Video, Mail, CheckCircle, XCircle, Loader2, ArrowRight } from 'lucide-react';
const VerifyEmailPage = () => {
const [searchParams] = useSearchParams();
const navigate = useNavigate();
const { updateUser } = useAuth();
const token = searchParams.get('token');
const [verificationMode, setVerificationMode] = useState(token ? 'token' : 'code');
@@ -31,6 +33,11 @@ const VerifyEmailPage = () => {
try {
const response = await authAPI.verifyEmailByToken(verificationToken);
if (response.success) {
// Update user and token if returned
if (response.data?.user && response.data?.token) {
updateUser(response.data.user);
localStorage.setItem('token', response.data.token);
}
setSuccess(true);
} else {
setError(response.error || 'Verification failed');
@@ -56,6 +63,11 @@ const VerifyEmailPage = () => {
try {
const response = await authAPI.verifyEmailByCode(email, code);
if (response.success) {
// Update user and token if returned
if (response.data?.user && response.data?.token) {
updateUser(response.data.user);
localStorage.setItem('token', response.data.token);
}
setSuccess(true);
} else {
setError(response.error || 'Verification failed');