Skip to content

fix(ui): preserve deeplink redirect after login#2926

Open
ZyphenSVC wants to merge 1 commit into
SpecterOps:mainfrom
ZyphenSVC:fix/issue-uiux-deeplinks-redirect
Open

fix(ui): preserve deeplink redirect after login#2926
ZyphenSVC wants to merge 1 commit into
SpecterOps:mainfrom
ZyphenSVC:fix/issue-uiux-deeplinks-redirect

Conversation

@ZyphenSVC

@ZyphenSVC ZyphenSVC commented Jun 25, 2026

Copy link
Copy Markdown

Description

This change fixes navigating BloodHound utilizing deeplinks when not logged in.

AuthenticatedRoute preserves the original route in React Router state when redirecting unauthenticated users to /login, but Login.tsx always redirects authenticated users to ROUTE_HOME instead of the deeplink route.

This change changes the state location and redirects users back to their original destination after successful authentication. If no prior route exists, it would go back to ROUTE_HOME as usual.

Motivation and Context

Resolves #2806

Users opening a Bloodhound deeplink while unauthenticated should be returned to that deeplink after logging in. This change fixes that, letting users land on the change query or graph instead of the default blank view.

How Has This Been Tested?

  1. Started local development environment with just bh-dev.
  2. Imported sample dataset.
  3. Created a functioning path between two users and copied deeplink.
  4. Opened the exact same deeplink when authenticated, then logged out and tried while unauthenticated.
  5. Confirmed that authenticated view redirected back to original deeplink.
  6. Confirmed that unauthenticated view redirected back to /login and then redirected back to original deeplink after authenticating.

Screenshots (optional):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Summary by CodeRabbit

  • Bug Fixes
    • Improved login redirect behavior so already signed-in users are sent back to their original destination instead of always landing on the home page.
    • Preserves the full target path, including query and hash details, when available.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 9961dd96-cc86-4059-8556-2824ba7ac73d

📥 Commits

Reviewing files that changed from the base of the PR and between 113c23e and 5eee1f7.

📒 Files selected for processing (1)
  • cmd/ui/src/views/Login.tsx

📝 Walkthrough

Walkthrough

Login now reads the preserved router location state, reconstructs the original deeplink path, and redirects authenticated users to that target instead of always sending them to the home route.

Changes

Login deeplink redirect

Layer / File(s) Summary
Read redirect state
cmd/ui/src/views/Login.tsx
useLocation is added, location.state.from is typed, and redirectTo is assembled from pathname, search, and hash with ROUTE_HOME as the fallback.
Use computed target
cmd/ui/src/views/Login.tsx
The authenticated-user redirect now uses redirectTo with replace semantics instead of a fixed home route.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main UI fix: preserving deeplink redirects after login.
Description check ✅ Passed The description follows the template and includes the change summary, motivation, testing, type, and checklist items.
Linked Issues check ✅ Passed The change matches issue #2806 by redirecting authenticated users back to the stored deeplink instead of ROUTE_HOME.
Out of Scope Changes check ✅ Passed The diff appears scoped to the login redirect flow in the UI and does not introduce unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ZyphenSVC

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

Bug: UI/UX Feedback: Unauthenticated deeplinks do not redirect

1 participant