Skip to content

Restrict access to authenticated-only features - #6

Merged
MasterGordon merged 1 commit into
mainfrom
restrict-unauthenticated-access-2097218213544781789
Apr 22, 2026
Merged

Restrict access to authenticated-only features#6
MasterGordon merged 1 commit into
mainfrom
restrict-unauthenticated-access-2097218213544781789

Conversation

@MasterGordon

Copy link
Copy Markdown
Owner

I have implemented several changes to ensure that parts of the application intended for logged-in users are properly restricted and provide clear "Call to Action" (CTA) points for guests.

Key changes:

  1. Route Protection: Created a ProtectedRoute component in src/main.tsx that gates access to /history, /settings, and /collection. Guests are now met with a friendly login message and CTA.
  2. Dynamic UI Visibility: Updated the sidebar in Shell.tsx to use the authenticated username from the server to determine which navigation links to show, replacing the less reliable local token check.
  3. Context-Specific CTAs:
    • The Store now displays a "Login to Buy" button for guests instead of a simple "Buy" button that would fail.
    • The Play page now shows a "Sign in to Play" button for guests.
    • Updated RegisterButton to accept a label prop for these custom CTAs.
  4. Session Integrity: Modified the startup logic in src/main.tsx to automatically remove the loginToken from localStorage if it's found to be invalid or expired during initial connection.
  5. Code Cleanup: Removed unused variables and imports identified during type checking.

PR created automatically by Jules for task 2097218213544781789 started by @MasterGordon

- Implement ProtectedRoute in main.tsx for history, settings, and collection.
- Update Shell.tsx to use server-side identity (user.getSelf) for navigation visibility.
- Add context-specific login CTAs to Store and Play pages.
- Clear invalid login tokens from localStorage on startup.
- Update RegisterButton to support custom labels.

Co-authored-by: MasterGordon <18127395+MasterGordon@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@MasterGordon
MasterGordon merged commit 19dcf02 into main Apr 22, 2026
1 of 2 checks passed
@MasterGordon
MasterGordon deleted the restrict-unauthenticated-access-2097218213544781789 branch April 22, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant