Reverted to commit 06ed528d76

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 15:58:56 +00:00
parent 1df9ada8ae
commit f37b99a5f9
33 changed files with 2509 additions and 140 deletions

View File

@@ -78,6 +78,7 @@ export function useAdminSettings() {
return settings?.filter(s => s.category === category) || [];
};
const updateSetting = async (key: string, value: any) => {
return updateSettingMutation.mutateAsync({ key, value });
};

View File

@@ -93,13 +93,23 @@ function AuthProviderComponent({ children }: { children: React.ReactNode }) {
const {
data: { subscription },
} = supabase.auth.onAuthStateChange((event, session) => {
console.log('[Auth] State change:', event, 'User:', session?.user?.email || 'none');
if (!isMountedRef.current) return;
const currentEmail = session?.user?.email;
const newEmailPending = session?.user?.new_email;
setSession(session);
setUser(session?.user ?? null);
// Explicitly handle SIGNED_IN event for iframe compatibility
if (event === 'SIGNED_IN' && session) {
console.log('[Auth] SIGNED_IN detected, setting session and user');
setSession(session);
setUser(session.user);
setLoading(false);
} else {
setSession(session);
setUser(session?.user ?? null);
}
// Track pending email changes
setPendingEmail(newEmailPending ?? null);

View File

@@ -0,0 +1,23 @@
import { useEffect } from 'react';
export function useCaptchaBypass() {
// Single layer: Check if environment allows bypass
const bypassEnabled = import.meta.env.VITE_ALLOW_CAPTCHA_BYPASS === 'true';
// Log warning if bypass is active
useEffect(() => {
if (bypassEnabled && typeof window !== 'undefined') {
console.warn(
'⚠️ CAPTCHA BYPASS IS ACTIVE\n' +
'CAPTCHA verification is disabled via VITE_ALLOW_CAPTCHA_BYPASS=true\n' +
'This should ONLY be enabled in development/preview environments.\n' +
'Ensure VITE_ALLOW_CAPTCHA_BYPASS=false in production!'
);
}
}, [bypassEnabled]);
return {
bypassEnabled,
requireCaptcha: !bypassEnabled,
};
}

View File

@@ -294,7 +294,7 @@ export function useEntityVersions(entityType: string, entityId: string) {
channelRef.current = null;
}
};
}, [entityType, entityId, fetchVersions]);
}, [entityType, entityId]);
// Set mounted ref on mount and cleanup on unmount
useEffect(() => {