Commit 573fe0b
committed
Fix: Add local: true and custom controller for invitation acceptance
Fixes the "Invitation token can't be blank" error that occurs when new
users accept email invitations and try to set their password.
Root cause: PR #6528 refactored form_for to form_with, but form_with
defaults to remote: true (AJAX submission) which can cause issues with
hidden field submission, particularly the invitation_token field.
Changes made:
1. Added local: true to form_with to use standard form submission
2. Removed readonly: true from invitation_token hidden field (unnecessary
and potentially problematic with form_with)
3. Created custom Users::InvitationsController to:
- Explicitly ensure invitation_token is set on resource in edit action
- Explicitly permit invitation_token in strong parameters
- Add logging to help debug token issues
4. Updated routes to use custom invitations controller
The custom controller provides better control over parameter handling
and includes debugging logs to identify any future token issues.
Related to PR #6528 (form helper refactor)1 parent c4a8e3a commit 573fe0b
File tree
3 files changed
+33
-3
lines changed- app
- controllers/users
- views/devise/invitations
- config
3 files changed
+33
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments