Conversation
6ac8763 to
a13b2be
Compare
jmilljr24
left a comment
There was a problem hiding this comment.
One comment regarding the turbo stuff. There's probably other places where turbo can be re-enabled with my suggestion but doesn't have to be part of this PR.
| method: :put, | ||
| html: { class: "space-y-4" }) do |f| %> | ||
| html: { class: "space-y-4" }, | ||
| data: { turbo: false }) do |f| %> |
There was a problem hiding this comment.
I would really try to avoid doing this. While it technically works, it sets a bad pattern of just turning off turbo without finding the root cause and obviously removes all the benefits that turbo provides.
I did some digging and found this config setting we should have.
# config/initializers/devise.rb
Devise.setup do |config|
# ...
config.responder.error_status = :unprocessable_entity
config.responder.redirect_status = :see_other
# ...
end
I'm wondering if this was part of the issue with some of our flaky specs regarding devise flows.
When the password reset failed validation (short password..) the controller would responded with turbo but status was 200 so the validation errors wouldn't display.
There was a problem hiding this comment.
ooooo, TYYY for finding that config setting! will submit a pr for that.
fa4f9d3 to
026762d
Compare
- Disable Turbo on password reset form to fix "button does nothing" bug - Redirect expired welcome token users to password reset instead of sign-in dead end (user has no known password) - Fix Font Awesome icon class on welcome page password toggles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a new user confirms their email after the welcome token expires, regenerate the token and send them to the welcome set-password page instead of the Devise password reset form. Distinguish email-change reconfirmation (existing users who have signed in) from initial account setup to avoid routing active users through the welcome flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Existing users confirming an email change are likely not signed in when clicking the link, so send them to sign-in with a clear message rather than bouncing through authenticate_user!. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Justin <16829344+jmilljr24@users.noreply.github.com>
PR #1443 removed token expiry, so the "expired token gets regenerated" test no longer applies. Updated to verify old tokens are kept as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n_count
Checking `previous_changes.key?("email")` directly detects whether this
confirmation was an email change, rather than inferring from sign_in_count.
Handles edge cases like legacy ported users (no welcome token, no sign-ins)
and users who happen to have a welcome token while doing an email change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c1ecc8a to
2ede30b
Compare
| def after_confirmation_success(resource) | ||
| if resource.welcome_instructions_token.present? | ||
| if resource.previous_changes.key?("email") | ||
| redirect_to new_user_session_path, notice: "Your email has been confirmed. Please sign in." |
There was a problem hiding this comment.
this is now true to what we're actually trying to separate -- the email change flow vs the initial welcome flow
What is the goal of this PR and why is this important?
How did you approach the change?
sign_in_countto distinguish new users (send to welcome flow) from existing users changing their email (send to sign-in with "confirmed" message)fa fa-eye→fa-solid fa-eyeon welcome page password toggle buttonsUI Testing Checklist
🤖 Generated with Claude Code