Skip to content

Offer sign-in to signed-out visitors#150

Merged
HamptonMakes merged 1 commit into
mainfrom
hampton/signed-out-sign-in
Jul 17, 2026
Merged

Offer sign-in to signed-out visitors#150
HamptonMakes merged 1 commit into
mainfrom
hampton/signed-out-sign-in

Conversation

@HamptonMakes

Copy link
Copy Markdown
Collaborator

Why

Booting the app locally and visiting / as a signed-out visitor gives you a landing page with no way to sign in (reported by Hampton). The nav's right-hand cluster only renders for signed-in users, and the hero CTAs were "Browse plans" — which 401s anonymously — and the agent API docs.

What

Mirrors the pattern the layout already uses for sign-out (main_app.respond_to?(:sign_out_path)):

  • Nav: signed-out visitors get a Sign in button (top right) when the host app exposes sign_in_path.
  • Landing hero: the primary CTA becomes Sign in for anonymous visitors (signed-in users keep Browse plans).

Hosts that authenticate at the perimeter (OIDC/BeyondCorp, like square-coplan) don't expose sign_in_path and render exactly as before — anonymous visitors never reach the page there anyway.

Testing

  • New request specs: anonymous / includes the sign-in link; signed-in "Browse plans" CTA hidden for anonymous visitors.
  • Full suite: 1132 examples, 0 failures.
  • Verified in headless Chrome: signed-out homepage shows Sign in both in the nav and as hero CTA.

Note: #140 (landing refresh, draft) touches _default_landing.html.erb too and will need a trivial rebase over this.

🤖 Generated with Claude Code

The public landing rendered with no path to authenticate: the nav's
right side only exists when signed in, and the hero CTAs were
"Browse plans" (401s anonymously) and the agent API docs. Mirror the
existing sign-out probe: when the host exposes sign_in_path, show a
Sign in button in the nav and as the hero's primary CTA. Hosts that
authenticate at the perimeter expose no sign_in_path and are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 722ce6c0a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +13 to +14
<% elsif main_app.respond_to?(:sign_in_path) %>
<%= link_to "Sign in", main_app.sign_in_path, class: "btn btn--primary" %>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use configured sign-in path for anonymous CTAs

In hosts that configure CoPlan's existing CoPlan.configuration.sign_in_path to something like Devise's /users/sign_in but do not define a route helper literally named sign_in_path, this condition stays false, so the signed-out landing page still renders without the new primary sign-in CTA. Protected engine pages already redirect via CoPlan.configuration.sign_in_path in CoPlan::ApplicationController#authenticate_coplan_user!, so this public CTA should use the same configured path instead of requiring a specific host helper name.

Useful? React with 👍 / 👎.

@HamptonMakes
HamptonMakes merged commit 0308c23 into main Jul 17, 2026
4 checks passed
@HamptonMakes
HamptonMakes deleted the hampton/signed-out-sign-in branch July 17, 2026 17:49
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