Skip to content

feat(web): add auth route guards & onboarding navigation logic - #130

Merged
Basharkhan7776 merged 1 commit into
Openlabsops:mainfrom
RAHULDINDIGALA-32:feature/auth-route-guards-115
Sep 27, 2026
Merged

Basharkhan7776 merged 1 commit into
Openlabsops:mainfrom
RAHULDINDIGALA-32:feature/auth-route-guards-115

Conversation

@RAHULDINDIGALA-32

Copy link
Copy Markdown
Contributor

Summary

Implements client-side authentication route guards and onboarding navigation for the web application. Protected routes now require a valid session and completed profile, while authenticated users are directed to onboarding or the dashboard based on their profile state.

Changes Made

  • Added useRequireAuth for client-side authentication and profile-completion checks.
  • Added reusable AuthGuard wrappers for protected route segments:
    • /dashboard
    • /forms/*
    • /templates/create
  • Added an onboarding route guard:
    • Unauthenticated users are redirected to /.
    • Users with completed profiles are redirected to /dashboard.
    • Authenticated users with incomplete profiles can continue onboarding.
  • Added landing-page navigation for authenticated users:
    • Incomplete profile (username and name/fullName missing) redirects to /onboarding.
    • Completed profile redirects to /dashboard.
  • Added Better Auth client typing for the custom username field.
  • Added session refresh on browser visibility changes to detect expired sessions.
  • Added centralized session-expiration cleanup for API 401 responses.
  • Added logout() cleanup to invalidate the client session and redirect protected routes to the auth entry page.
  • Added tests for profile routing, session expiration, and 401 redirect behavior.
  • Fixes [Feature] Auth Route Guards & Onboarding Navigation Logic #115.

Testing

  • bun run lint passes.
  • bunx tsc --noEmit passes.
  • bun run test passes: 21 tests.
  • bun run build passes.
  • Manual testing completed (for protected-route redirects, onboarding redirects, and session-expiration handling).
  • No regressions introduced.

Related Issues

Screenshots (if applicable)

Not applicable, as this PR adds authentication and navigation infrastructure without visual UI changes.

Checklist

  • Code follows project conventions.
  • Tests pass.
  • Documentation updated where needed through this PR description.
  • No linting errors in updated files.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c81f00cf-a443-4c6f-9d7c-13f6d4d06518


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Basharkhan7776 Basharkhan7776 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging

@Basharkhan7776
Basharkhan7776 merged commit e1e4874 into Openlabsops:main Sep 27, 2026
3 checks passed
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.

[Feature] Auth Route Guards & Onboarding Navigation Logic

2 participants