mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 22:31:12 -05:00
Reverted to commit 06ed528d76
This commit is contained in:
@@ -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 });
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
23
src/hooks/useCaptchaBypass.ts
Normal file
23
src/hooks/useCaptchaBypass.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user