Skip to content

Extend Castle integration across the full user lifecycle#20

Merged
bartes merged 1 commit into
mainfrom
lifecycle-workflows
Jun 3, 2026
Merged

Extend Castle integration across the full user lifecycle#20
bartes merged 1 commit into
mainfrom
lifecycle-workflows

Conversation

@bartes

@bartes bartes commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What & why

The app already scored login (risk/filter), and logged logout and profile updates. This extends Castle coverage to the rest of the user lifecycle so the example mirrors a real end-to-end integration, and makes sure every Castle-bound form carries a request token minted in the browser by castle.js.

Changes

  • Sign up is now risk-assessed ($registrationrisk). A deny verdict rolls the registration back (mirroring the login flow); invalid attempts are reported to filter.
  • Custom event ($custom) is available from the profile page, once signed in.
  • Request tokens everywhere — the sign-up, profile-update, custom-event and logout forms all mint and forward a castle_request_token. Logout becomes a small button_to form so it too can mint a token.
  • Home page copy and readme updated to describe the fuller lifecycle.
  • RSpec coverage for the new registration, custom-event and token-carrying paths.

Known limitations

  • There is no dedicated password-reset flow: Devise :recoverable is not enabled in this demo, so the existing "edit password" screen is left as-is rather than instrumented as a Castle $password_reset event.
  • Custom and logout events use the non-blocking log endpoint, so they are fire-and-forget and not verdict-driven.

Build on the existing login/logout/profile wiring so every authentication
touch-point is instrumented and carries a browser-minted request token.

- score sign-ups with the risk endpoint ($registration); a deny verdict rolls
  the registration back, mirroring the login flow, and invalid attempts are
  reported to filter
- add a post-login custom event ($custom) from the profile page
- forward the castle.js request token on the sign-up, profile-update, custom
  event and logout forms (logout becomes a small form so it can mint a token)
- update the home page copy and readme; specs for the new and changed paths
@bartes bartes merged commit de96ded into main Jun 3, 2026
1 check passed
@bartes bartes deleted the lifecycle-workflows branch June 6, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant