Offer sign-in to signed-out visitors#150
Conversation
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>
There was a problem hiding this comment.
💡 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".
| <% elsif main_app.respond_to?(:sign_in_path) %> | ||
| <%= link_to "Sign in", main_app.sign_in_path, class: "btn btn--primary" %> |
There was a problem hiding this comment.
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 👍 / 👎.
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)):Sign inbutton (top right) when the host app exposessign_in_path.Sign infor anonymous visitors (signed-in users keepBrowse plans).Hosts that authenticate at the perimeter (OIDC/BeyondCorp, like square-coplan) don't expose
sign_in_pathand render exactly as before — anonymous visitors never reach the page there anyway.Testing
/includes the sign-in link; signed-in "Browse plans" CTA hidden for anonymous visitors.Note: #140 (landing refresh, draft) touches
_default_landing.html.erbtoo and will need a trivial rebase over this.🤖 Generated with Claude Code