This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

try again

+60 -31
+17 -12
src/components/Login/Login.js
··· 13 13 const queryParams = new URLSearchParams(location.search); 14 14 const returnUrl = queryParams.get('returnUrl') || '/verifier'; 15 15 16 - console.log('Login component loaded with returnUrl =', returnUrl); 16 + console.log('Login component: returnUrl =', returnUrl); 17 + 18 + // Log auth status to debug 19 + useEffect(() => { 20 + console.log('Login component auth status:', { 21 + isAuthenticated, 22 + loading, 23 + hasError: !!error, 24 + returnUrl 25 + }); 26 + }, [isAuthenticated, loading, error, returnUrl]); 17 27 18 28 // Handle redirection after successful authentication 19 29 useEffect(() => { 20 30 if (isAuthenticated) { 21 - console.log('Login page: User is authenticated, redirecting to:', returnUrl); 31 + console.log('Login: User is authenticated, redirecting to', returnUrl); 22 32 23 - // First try React Router navigation 24 - navigate(returnUrl, { replace: true }); 25 - 26 - // As a backup, also use direct redirection after a short delay 33 + // Set a short delay to ensure state updates complete 27 34 setTimeout(() => { 28 - if (window.location.pathname !== returnUrl.split('?')[0]) { 29 - console.log('Login page: Using fallback redirect to:', returnUrl); 30 - window.location.href = returnUrl; 31 - } 32 - }, 200); 35 + console.log('Login: Executing redirect to', returnUrl); 36 + window.location.replace(returnUrl); 37 + }, 100); 33 38 } 34 - }, [isAuthenticated, navigate, returnUrl]); 39 + }, [isAuthenticated, returnUrl]); 35 40 36 41 const handleInputChange = (event) => { 37 42 setHandle(event.target.value);
+14 -14
src/components/ProtectedRoute.jsx
··· 6 6 const { isAuthenticated, loading } = useAuth(); 7 7 const location = useLocation(); 8 8 9 - // Simple and direct redirect approach 9 + // Use a side effect to check authentication and redirect if needed 10 10 useEffect(() => { 11 - // Only check after loading is complete 11 + // If we're still loading, wait 12 12 if (loading) { 13 - console.log('ProtectedRoute: Still loading auth status...'); 13 + console.log('ProtectedRoute: Waiting for auth to complete...'); 14 14 return; 15 15 } 16 16 17 - // If not authenticated, redirect directly via window.location 17 + // If not authenticated, redirect immediately 18 18 if (!isAuthenticated) { 19 - console.log('ProtectedRoute: Not authenticated, redirecting to login...'); 19 + console.log('ProtectedRoute: Not authenticated, forcing redirect to login...'); 20 20 const redirectUrl = `/login?returnUrl=${encodeURIComponent(location.pathname + location.search)}`; 21 - window.location.href = redirectUrl; 21 + 22 + // Force redirect - this is the simplest, most reliable approach 23 + window.location.replace(redirectUrl); 22 24 } else { 23 - console.log('ProtectedRoute: User is authenticated, rendering content'); 25 + console.log('ProtectedRoute: User is authenticated, allowing access'); 24 26 } 25 - }, [isAuthenticated, loading, location]); 27 + }, [isAuthenticated, loading, location.pathname, location.search]); 26 28 27 - // Show loading state while checking auth 29 + // Keep the component simple - only render children if authenticated 28 30 if (loading) { 29 - return <div className="auth-loading">Checking authentication status...</div>; 31 + return <div className="auth-loading">Checking authentication...</div>; 30 32 } 31 - 32 - // Show redirecting state if not authenticated 33 + 33 34 if (!isAuthenticated) { 34 - return <div className="auth-redirecting">Redirecting to login...</div>; 35 + return <div className="auth-redirecting">Not authenticated - redirecting to login...</div>; 35 36 } 36 37 37 - // User is authenticated, render children 38 38 return children; 39 39 }; 40 40
+22 -5
src/components/Verifier/Verifier.js
··· 644 644 if (isAuthLoading) return <p>Loading authentication...</p>; 645 645 if (authError) return <p>Authentication Error: {authError}. <a href="/login">Please login</a>.</p>; 646 646 647 - // Simple auth check for debugging - this should never actually render if ProtectedRoute is working 648 - if (!session) { 649 - console.log('Verifier: Session missing, should be redirected by ProtectedRoute'); 650 - return <p>You need to be logged in to use the Verifier. Redirecting...</p>; 647 + // Direct redirect for unauthenticated users as a backup 648 + if (!isAuthenticated) { 649 + console.log('Verifier: Detected unauthenticated user, forcing redirect'); 650 + 651 + // Force redirect as an additional failsafe 652 + setTimeout(() => { 653 + const redirectUrl = `/login?returnUrl=${encodeURIComponent(window.location.pathname)}`; 654 + window.location.replace(redirectUrl); 655 + }, 100); 656 + 657 + return <p>Authentication required. Redirecting to login...</p>; 658 + } 659 + 660 + // Verify we have a valid session 661 + if (!session || !session.did) { 662 + console.log('Verifier: Session invalid, forcing redirect'); 663 + window.location.replace('/login'); 664 + return <p>Session invalid. Redirecting to login...</p>; 651 665 } 652 666 653 667 const isAnyOperationInProgress = isVerifying || isRevoking || isLoadingVerifications || isLoadingNetwork || isCheckingValidity; ··· 657 671 <div className="verifier-intro-container"> 658 672 <h1>Bluesky Verifier Tool</h1> 659 673 <p className="verifier-intro-text"> 660 - With Bluesky's new decentralized verification system, anyone can verify anyone else and any Bluesky client can choose which accounts to treat as "Trusted Verifiers". Try verifying an account for yourself or check to see who has verified you! It's as simple as creating a verification record in your PDS that points to the account you want to verify. 674 + With Bluesky's new decentralized verification system, anyone can verify anyone else and any Bluesky client can choose which accounts to treat as "Trusted Verifiers". 675 + </p> 676 + <p className="verifier-intro-text"> 677 + Try verifying an account for yourself or check to see who has verified you! It's as simple as creating a verification record in your PDS that points to the account you want to verify. 661 678 </p> 662 679 </div> 663 680
+7
src/contexts/AuthContext.js
··· 139 139 loading, 140 140 hasError: !!error 141 141 }); 142 + 143 + // Force a page refresh if session state changes and we're on a protected path 144 + // This ensures the latest auth state is always used for route protection 145 + if (!loading && window.location.pathname === '/verifier' && !session) { 146 + console.log('(AuthProvider) No session on protected page, forcing refresh'); 147 + window.location.reload(); 148 + } 142 149 }, [session, loading, error]); 143 150 144 151 return (