fixes recaptcha
Build And Push Image / docker (push) Successful in 3m12s Details

This commit is contained in:
Matt 2025-08-08 21:10:00 +02:00
parent 3951ce1d4e
commit aed8dc68fc
4 changed files with 88 additions and 6 deletions

View File

@ -75,12 +75,19 @@ export default defineNuxtConfig({
title: "MonacoUSA Portal", title: "MonacoUSA Portal",
meta: [ meta: [
{ property: "og:title", content: "MonacoUSA Portal" }, { property: "og:title", content: "MonacoUSA Portal" },
{ property: "og:image", content: "/og-image.png" }, { property: "og:image", content: "/MONACOUSA-Flags_376x376.png" },
{ name: "twitter:card", content: "summary_large_image" }, { name: "twitter:card", content: "summary_large_image" },
{ name: "viewport", content: "width=device-width, initial-scale=1" }, { name: "viewport", content: "width=device-width, initial-scale=1" },
{ name: "apple-mobile-web-app-capable", content: "yes" }, { name: "apple-mobile-web-app-capable", content: "yes" },
{ name: "apple-mobile-web-app-status-bar-style", content: "default" }, { name: "apple-mobile-web-app-status-bar-style", content: "default" },
{ name: "apple-mobile-web-app-title", content: "MonacoUSA Portal" }, { name: "apple-mobile-web-app-title", content: "MonacoUSA Portal" },
{ name: "theme-color", content: "#a31515" },
],
link: [
{ rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
{ rel: "icon", type: "image/png", sizes: "192x192", href: "/icon-192x192.png" },
{ rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
{ rel: "shortcut icon", href: "/favicon-32x32.png" },
], ],
htmlAttrs: { htmlAttrs: {
lang: "en", lang: "en",

View File

@ -386,19 +386,25 @@ async function submitRegistration() {
// Load configurations on mount // Load configurations on mount
onMounted(async () => { onMounted(async () => {
try { try {
// Load reCAPTCHA config (public endpoint) // Load reCAPTCHA config (public endpoint - no authentication required)
const recaptchaResponse = await $fetch('/api/admin/recaptcha-config') as any; const recaptchaResponse = await $fetch('/api/recaptcha-config') as any;
if (recaptchaResponse?.success && recaptchaResponse?.data?.siteKey) { if (recaptchaResponse?.success && recaptchaResponse?.data?.siteKey) {
recaptchaConfig.value.siteKey = recaptchaResponse.data.siteKey; recaptchaConfig.value.siteKey = recaptchaResponse.data.siteKey;
console.log('✅ reCAPTCHA site key loaded successfully');
} else {
console.warn('❌ reCAPTCHA not configured or failed to load');
} }
// Load registration config (public endpoint) // Load registration config (public endpoint - no authentication required)
const registrationResponse = await $fetch('/api/admin/registration-config') as any; const registrationResponse = await $fetch('/api/registration-config') as any;
if (registrationResponse?.success) { if (registrationResponse?.success) {
registrationConfig.value = registrationResponse.data; registrationConfig.value = registrationResponse.data;
console.log('✅ Registration config loaded successfully');
} else {
console.warn('❌ Registration config failed to load');
} }
} catch (error) { } catch (error) {
console.warn('Failed to load configuration:', error); console.error('Failed to load configuration:', error);
// Page will still work with default values // Page will still work with default values
} }
}); });

View File

@ -0,0 +1,31 @@
export default defineEventHandler(async (event) => {
console.log('[api/recaptcha-config.get] =========================');
console.log('[api/recaptcha-config.get] GET /api/recaptcha-config - Get public reCAPTCHA configuration');
try {
// Get reCAPTCHA configuration (public access - only return site key)
const { getRecaptchaConfig } = await import('~/server/utils/admin-config');
const config = getRecaptchaConfig();
console.log('[api/recaptcha-config.get] Returning site key:', config.siteKey ? 'configured' : 'not configured');
return {
success: true,
data: {
siteKey: config.siteKey || '',
// Don't return secret key for public access
}
};
} catch (error: any) {
console.error('[api/recaptcha-config.get] ❌ Error getting public reCAPTCHA config:', error);
return {
success: false,
error: 'Failed to get reCAPTCHA configuration',
data: {
siteKey: ''
}
};
}
});

View File

@ -0,0 +1,38 @@
export default defineEventHandler(async (event) => {
console.log('[api/registration-config.get] =========================');
console.log('[api/registration-config.get] GET /api/registration-config - Get public registration configuration');
try {
// Get registration configuration (public access - safe to expose)
const { getRegistrationConfig } = await import('~/server/utils/admin-config');
const config = getRegistrationConfig();
console.log('[api/registration-config.get] Returning registration config:', {
membershipFee: config.membershipFee,
hasIban: !!config.iban,
hasAccountHolder: !!config.accountHolder
});
return {
success: true,
data: {
membershipFee: config.membershipFee || 50,
iban: config.iban || '',
accountHolder: config.accountHolder || ''
}
};
} catch (error: any) {
console.error('[api/registration-config.get] ❌ Error getting public registration config:', error);
return {
success: false,
error: 'Failed to get registration configuration',
data: {
membershipFee: 50,
iban: '',
accountHolder: ''
}
};
}
});