Skip to content

Updated private page access and signup flow#26876

Closed
ErisDS wants to merge 10 commits intomainfrom
codex/private-page-subscribe-flow
Closed

Updated private page access and signup flow#26876
ErisDS wants to merge 10 commits intomainfrom
codex/private-page-subscribe-flow

Conversation

@ErisDS
Copy link
Member

@ErisDS ErisDS commented Mar 18, 2026

Continuation of #26762 (lost push access to fork). Contains all review fixes plus original work.

Review fixes (9 commits on top of original)

Bug fixes: json helper undefined crash, integrity token ok check, error normalization (type-based matching, removed dead code), admin:url config sanitization (strips /ghost, warns), console.error revert.

Improvements: localized Site owner login, aria-label on email input, email trim, promoted helpers to global, added @site.admin_url, removed redundant admin_url helper, gscan cross-reference test.

Tests: 3 unhappy path tests, error normalization tests, middleware admin_url test, config sanitization tests.

See #26762 review comment for full details: #26762 (review)

JohnONolan and others added 10 commits March 18, 2026 15:03
Reworked Ghost core's private page to use the new access dialog, optional subscribe form, accent-aware styling, and a dedicated runtime script without pulling Portal onto the page. Also adds the helper, asset pipeline, and test coverage needed to ship and maintain the new flow.
…g, and i18n gap

- Guard json helper against JSON.stringify(undefined) returning undefined
- Check integrityTokenRes.ok before calling .text() in private.js
- Wrap "Site owner login" in {{t}} for i18n support
- Add locale fixture entries and test coverage for all three fixes
- Moved json, color_to_rgba, contrast_text_color from private-blogging app to core/frontend/helpers/
- Added admin_url to @site template context, updated private.hbs to use {{@site.admin_url}}
- Added gscan cross-reference test to catch helpers missing from gscan knownHelpers
- Updated helpers.test.js allowlist with the three new global helpers
- Replaced brittle exact-string error matching with type-based matching
  (TooManyRequestsError) and keyword regex (restricted domain)
- Removed dead failedMagicLink code path that could never match
- Added aria-label to signup email input for screen readers
- Trim email whitespace before checkValidity() runs
- Reverted unrelated console.error to logging.error change in bin script
…ved tests, fixed gscan test

- Removed admin_url helper file (superseded by @site.admin_url data)
- Moved json, color_to_rgba, contrast_text_color tests to helpers dir
- Fixed gscan cross-reference test: tracks exact pending set so it fails
  if a new helper is added without updating gscan or the pending list
- Added middleware test verifying admin_url in @site data
- Client-side validation failure (checkValidity returns false)
- Network error (fetch throws, e.g. offline)
- Unparseable error response body (API returns non-JSON)
Removed pendingGscanUpdate workaround — the test now correctly
fails for color_to_rgba, contrast_text_color, json until they
are added to gscan knownHelpers.
Removed raw and search from internalHelpers exclusion list — they
should be in gscan knownHelpers. Test now fails for all 5 helpers
pending gscan PR: TryGhost/gscan#742
…gured

urlUtils.urlFor("admin", true) joins the admin URL with "/ghost/",
but when admin:url already contains "/ghost/" this produces a doubled
path like "/ghost/ghost/". Use getAdminUrl() which returns the URL
directly from config, falling back to urlFor for environments where
no separate admin URL is configured.
admin:url should be the base URL (e.g. https://admin.example.com)
without /ghost — urlFor adds that automatically. If /ghost is present
in the config, all 22 callers of urlFor("admin", true) produce a
doubled path like /ghost/ghost/.

Added sanitizeAdminUrl to config loader which strips /ghost from the
path and logs a warning. Reverted the workaround in
update-local-template-options.js since the real fix belongs in config
sanitization.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43df1c31-5f3c-4375-88ed-a76383ef9d31

📥 Commits

Reviewing files that changed from the base of the PR and between 832456d and 4116425.

📒 Files selected for processing (24)
  • ghost/core/bin/minify-assets.js
  • ghost/core/core/frontend/apps/private-blogging/lib/helpers/input_password.js
  • ghost/core/core/frontend/apps/private-blogging/lib/views/private.hbs
  • ghost/core/core/frontend/helpers/color_to_rgba.js
  • ghost/core/core/frontend/helpers/contrast_text_color.js
  • ghost/core/core/frontend/helpers/json.js
  • ghost/core/core/frontend/public/ghost.css
  • ghost/core/core/frontend/public/private.js
  • ghost/core/core/frontend/services/theme-engine/middleware/update-local-template-options.js
  • ghost/core/core/frontend/web/routers/serve-public-file.js
  • ghost/core/core/shared/config/loader.js
  • ghost/core/core/shared/config/utils.js
  • ghost/core/test/unit/frontend/apps/private-blogging/controller.test.js
  • ghost/core/test/unit/frontend/apps/private-blogging/input-password.test.js
  • ghost/core/test/unit/frontend/helpers/color-to-rgba.test.js
  • ghost/core/test/unit/frontend/helpers/contrast-text-color.test.js
  • ghost/core/test/unit/frontend/helpers/json.test.js
  • ghost/core/test/unit/frontend/public/private.test.js
  • ghost/core/test/unit/frontend/services/theme-engine/handlebars/helpers.test.js
  • ghost/core/test/unit/frontend/services/theme-engine/middleware.test.js
  • ghost/core/test/unit/frontend/web/middleware/serve-public-file.test.js
  • ghost/core/test/unit/shared/config/utils.test.js
  • ghost/core/test/utils/fixtures/themes/locale-theme/locales/de.json
  • ghost/core/test/utils/fixtures/themes/locale-theme/locales/en.json

Walkthrough

This PR implements a private blogging feature with comprehensive frontend and configuration updates. It adds new template helpers for color conversion and JSON serialization, introduces a private-blogging template with a modal-based access dialog, and includes a client-side runtime script for handling newsletter subscriptions and access code validation. The changes extend CSS styling for private UI elements, add configuration sanitization for admin URLs, register new public asset routes, update the password input helper for 1Password support, and include extensive test coverage alongside localization updates for English and German locales.

Possibly related PRs

Suggested labels

affects:i18n

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch codex/private-page-subscribe-flow
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/private-page-subscribe-flow
📝 Coding Plan
  • Generate coding plan for human review comments

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

@ErisDS ErisDS closed this Mar 18, 2026
@ErisDS ErisDS deleted the codex/private-page-subscribe-flow branch March 18, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants