Files
monacousa-portal/src/routes/api/auth/resend-verification/+server.ts
Matt e7338d1a70 Initial production deployment setup
- Production docker-compose with nginx support
- Nginx configuration for portal.monacousa.org
- Deployment script with backup/restore
- Gitea CI/CD workflow
- Fix CountryFlag reactivity for dropdown flags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:19:49 +01:00

31 lines
822 B
TypeScript

import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
export const POST: RequestHandler = async ({ locals, url }) => {
const { session, user } = await locals.safeGetSession();
if (!session || !user) {
return json({ error: 'Not authenticated' }, { status: 401 });
}
if (!user.email) {
return json({ error: 'No email associated with account' }, { status: 400 });
}
// Resend verification email
const { error } = await locals.supabase.auth.resend({
type: 'signup',
email: user.email,
options: {
emailRedirectTo: `${url.origin}/join?verified=true`
}
});
if (error) {
console.error('Failed to resend verification email:', error);
return json({ error: error.message }, { status: 500 });
}
return json({ success: true, message: 'Verification email sent' });
};