diff --git a/pages/dashboard/admin.vue b/pages/dashboard/admin.vue index 32d4ab2..4fb123e 100644 --- a/pages/dashboard/admin.vue +++ b/pages/dashboard/admin.vue @@ -161,6 +161,55 @@ + + + + + + mdi-email-cog + Email Configuration + + +

Configure SMTP settings for email notifications and verification.

+ + + mdi-email-settings + Configure Email + +
+
+
+ + + + + mdi-cog-outline + All Settings + + +

Access all portal configuration settings in one place.

+ + + mdi-cog + Portal Settings + +
+
+
+
+ @@ -418,6 +467,7 @@ const showCreateUserDialog = ref(false); const showAdminConfig = ref(false); const showRecaptchaConfig = ref(false); const showMembershipConfig = ref(false); +const showEmailConfig = ref(false); // Create user dialog data const createUserValid = ref(false); @@ -531,6 +581,21 @@ const handleAdminConfigSaved = () => { showAdminConfig.value = false; }; +// Handle opening email configuration directly +const openEmailConfig = () => { + // Set the activeTab to email when opening the admin config dialog + showEmailConfig.value = true; + showAdminConfig.value = true; +}; + +// Watch for showEmailConfig to set the initial tab +watch(showEmailConfig, (newValue) => { + if (newValue) { + // This will be handled by the AdminConfigurationDialog to set initial tab + showEmailConfig.value = false; // Reset the flag + } +}); + const saveRecaptchaConfig = async () => { if (!recaptchaValid.value) return; diff --git a/pages/signup.vue b/pages/signup.vue index 974737a..a983c8a 100644 --- a/pages/signup.vue +++ b/pages/signup.vue @@ -422,59 +422,44 @@ function loadRecaptchaScript(siteKey: string) { document.head.appendChild(script); } -// Add page initialization state -const pageReady = ref(false); - -// Load configurations on mount +// Simplified initialization - prevent reload loops onMounted(async () => { - console.log('🚀 Initializing signup page...'); + // Prevent multiple initializations + if (typeof window === 'undefined') return; - // Set a timeout to ensure page shows even if API calls fail - const initTimeout = setTimeout(() => { - if (!pageReady.value) { - console.warn('⚠️ API calls taking too long, showing page with defaults'); - pageReady.value = true; - } - }, 3000); - try { - // Load reCAPTCHA config with timeout - try { - const recaptchaResponse = await Promise.race([ - $fetch('/api/recaptcha-config'), - new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 2000)) - ]) as any; + // Load configs without complex timeout logic + Promise.all([ + // Load reCAPTCHA config + $fetch('/api/recaptcha-config').then((response: any) => { + if (response?.success && response?.data?.siteKey) { + recaptchaConfig.value.siteKey = response.data.siteKey; + loadRecaptchaScript(response.data.siteKey); + } + }).catch(() => { + // Silently fail for reCAPTCHA - not critical + }), - if (recaptchaResponse?.success && recaptchaResponse?.data?.siteKey) { - recaptchaConfig.value.siteKey = recaptchaResponse.data.siteKey; - loadRecaptchaScript(recaptchaConfig.value.siteKey); - console.log('✅ reCAPTCHA site key loaded successfully'); - } - } catch (error) { - console.warn('❌ reCAPTCHA config failed to load:', error); - } - - // Load registration config with timeout - try { - const registrationResponse = await Promise.race([ - $fetch('/api/registration-config'), - new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 2000)) - ]) as any; - - if (registrationResponse?.success) { - registrationConfig.value = registrationResponse.data; - console.log('✅ Registration config loaded successfully'); - } - } catch (error) { - console.warn('❌ Registration config failed to load:', error); - } + // Load registration config + $fetch('/api/registration-config').then((response: any) => { + if (response?.success) { + registrationConfig.value = response.data; + } + }).catch(() => { + // Use defaults if config fails to load + registrationConfig.value = { + membershipFee: 150, + iban: 'MC58 1756 9000 0104 0050 1001 860', + accountHolder: 'ASSOCIATION MONACO USA' + }; + }) + ]).catch(() => { + // Global fallback - don't let errors cause page reload + }); } catch (error) { - console.error('Failed to load configuration:', error); - } finally { - clearTimeout(initTimeout); - pageReady.value = true; - console.log('✅ Signup page ready'); + // Prevent any errors from bubbling up and causing reload + console.warn('Signup page initialization error:', error); } });