Skip to content

Conversation

@laurynasgadl
Copy link
Member

@laurynasgadl laurynasgadl commented Jan 14, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved logout flow for proxy-based authentication when an external logout URL is configured: the app now calls the external logout endpoint first and then redirects users to the login page to ensure sessions are cleaned up reliably.
    • Adjusted control flow so the external logout step takes precedence over previous fallback behavior for proxy scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Logout now conditionally POSTs to an exported authLogoutURL for proxy-based auth, then navigates to /login; this new step runs before the existing fallback logout behavior.

Changes

Cohort / File(s) Changes Summary
Authentication utilities
frontend/src/utils/constants.ts, frontend/src/utils/auth.ts
Added exported authLogoutURL constant; logout() now, when noAuth is false and authMethod === "proxy" with a non-empty authLogoutURL, performs a POST to that URL before redirecting to /login, inserted ahead of the existing fallback logout flow.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant App as Frontend App
  participant Auth as Auth Proxy/Service
  participant Router as Browser Router

  Client->>App: invoke logout()
  App->>App: check noAuth && authMethod === "proxy" && authLogoutURL
  alt proxy logout path
    App->>Auth: POST authLogoutURL
    Auth-->>App: 200/response
    App->>Router: navigate("/login")
  else fallback
    App->>Router: navigate(logoutPage or /login)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: adjusting logout logic specifically for the proxy auth method, which is the primary focus of the modifications in auth.ts.

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

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
frontend/src/utils/auth.ts (1)

140-144: Fix formatting issue flagged by linter.

Static analysis indicates a formatting issue around line 140. The empty line at line 144 after the .catch() block may contain trailing whitespace that needs to be removed.

🧹 Suggested formatting fix
     })
-    .catch(() => {
-      console.error("Failed to logout using proxy auth");
-    });
-
-    router.push({
+      .catch(() => {
+        console.error("Failed to logout using proxy auth");
+      });
+    router.push({
       path: "/login",
     });

Alternatively, run your project's formatter (e.g., prettier --write) to auto-fix this.


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00dcc65 and e5336fc.

📒 Files selected for processing (1)
  • frontend/src/utils/auth.ts
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/utils/auth.ts (2)
frontend/src/utils/constants.ts (2)
  • authMethod (42-42)
  • authLogoutURL (43-43)
frontend/src/router/index.ts (2)
  • router (221-221)
  • router (221-221)
🪛 GitHub Check: Lint Frontend
frontend/src/utils/auth.ts

[warning] 140-140:
Delete ⏎····

🔇 Additional comments (2)
frontend/src/utils/auth.ts (2)

5-11: LGTM!

The import of authLogoutURL from constants is correctly added and necessary for the new proxy logout logic.


133-147: Implementation looks good with previous feedback addressed.

The error handling via .catch() has been added as requested in the prior review. The fire-and-forget pattern with immediate navigation to /login is appropriate for this Hostinger-specific proxy auth flow.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/src/utils/auth.ts`:
- Around line 133-143: The proxy logout branch (authMethod === "proxy" &&
authLogoutURL !== "") currently fire-and-forgets the fetch and immediately
navigates, so add a .catch() to the fetch call to log any failures (use
console.error or the existing logger) and keep the function synchronous (do not
make logout() async) so callers/handlers are unaffected; also add a brief
comment by the router.push explaining why the reason param is not passed in this
Hostinger-specific flow for clarity.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91f2618 and 00dcc65.

📒 Files selected for processing (1)
  • frontend/src/utils/auth.ts
🔇 Additional comments (1)
frontend/src/utils/auth.ts (1)

5-11: LGTM!

Clean import addition for the new authLogoutURL constant.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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