Skip to content

Conversation

@vaibhav45sktech
Copy link

@vaibhav45sktech vaibhav45sktech commented Dec 6, 2025

This PR customizes the initial 401 Unauthorized page in private setups by adding a friendly login prompt.

  • Shows message instead of empty 401
  • Encourages user to login
  • Includes link to /login
  • Works only for 401
  • No backend changes

Fixes #149

Summary by CodeRabbit

  • New Features
    • Added specialized error messaging for authentication failures, displaying a custom login prompt when unauthorized (401) errors occur.
    • Improved error display with targeted responses based on error type, with generic fallback messaging for other errors.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

📝 Walkthrough

Walkthrough

This change adds special handling for 401 Unauthorized errors in the error notification component. The controller now exposes the error code as a binding, and the template conditionally renders a custom login prompt for 401 errors while displaying generic error messages for all other codes.

Changes

Cohort / File(s) Summary
Error notification 401 handling
public/js/components/error-notification/error-notifcation.js, public/js/components/error-notification/error-notification.html
Controller exposes error code binding via ctrl.code = $ctrl.key. Template replaces single error display with key-based branching: renders custom login prompt when key equals 401; otherwise displays generic error message via fallback. Removes dependency on entity.hasError($ctrl.key) constant display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single straightforward assignment added to controller initialization
  • Template conditional logic is clear and limited in scope
  • Changes are cohesive and directly related to the 401 error handling feature

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: customize 401 Unauthorized page with login prompt' accurately and concisely describes the main change: adding a custom login prompt for 401 Unauthorized responses.
Linked Issues check ✅ Passed The PR successfully addresses issue #149 by customizing the 401 Unauthorized page with a friendly login prompt and link, replacing the default empty 401 response as required.
Out of Scope Changes check ✅ Passed All changes are directly related to customizing the 401 error page with a login prompt. No out-of-scope modifications to unrelated features or components are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@vaibhav45sktech
Copy link
Author

vaibhav45sktech commented Dec 6, 2025

hello @JJ-Author ! Hi, I’ve implemented a customized 401 Unauthorized page for private setups. This replaces the default browser 401 message with a friendly login prompt. Please review and let me know if any changes are needed.

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

🧹 Nitpick comments (1)
public/js/components/error-notification/error-notification.html (1)

1-11: 401‑specific template matches requirements; consider keeping text configurable/i18n‑friendly

This template cleanly introduces a 401‑only branch with a clear login prompt and a /login link, and falls back to the existing get($ctrl.key) messaging for all other codes, which aligns well with the PR’s goal.

One thing to watch: for 401 you now bypass DatabusMsg.get(...) and hardcode English strings. If Databus previously supported localization or if you want “customizable” text without editing templates, consider routing these through your message/config system as well (e.g., dedicated keys for the 401 title, body, and link label).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2fff158 and dc677e0.

📒 Files selected for processing (2)
  • public/js/components/error-notification/error-notifcation.js (1 hunks)
  • public/js/components/error-notification/error-notification.html (1 hunks)

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.

Customize initial 401 Unauthorized page (in a private setup)

1 participant