diff --git a/frontend/src/routes/verify.$code.tsx b/frontend/src/routes/verify.$code.tsx
index 4fa80663..ab681a06 100644
--- a/frontend/src/routes/verify.$code.tsx
+++ b/frontend/src/routes/verify.$code.tsx
@@ -24,7 +24,19 @@ function VerifyEmail() {
// Do both refetch and navigation after a delay
setTimeout(async () => {
await refetchUser();
- navigate({ to: "/" });
+
+ // Check for a pending redirect (e.g. team invite page)
+ const pendingRedirect = sessionStorage.getItem("post_auth_redirect");
+ sessionStorage.removeItem("post_auth_redirect");
+ if (
+ pendingRedirect &&
+ pendingRedirect.startsWith("/") &&
+ !pendingRedirect.startsWith("//")
+ ) {
+ navigate({ to: pendingRedirect });
+ } else {
+ navigate({ to: "/" });
+ }
}, 2000);
} catch (err) {
if (err instanceof Error) {