Commit c723131
Fix: scope login_with_passkey_form_for to the Devise resource (#134)
* fix: scope form helpers to the Devise resource
The form helpers (login_with_passkey_form_for, etc.) used form_with
without a scope, so form builder fields like f.check_box :remember_me
generated name="remember_me" instead of name="account[remember_me]".
Since the passkey strategy reads params[scope][:remember_me], the value
was never found.
Resolve the scope via Devise::Mapping.find_scope! and pass it to
form_with. Switch the internal public_key_credential hidden field to
hidden_field_tag so it stays at the top-level params where strategies
and controllers expect it. Update controllers to read :name from the
now-scoped params.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix rubocop
* docs: add changelog entry for scoped form helpers fix
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: narrow scope change to login_with_passkey_form_for only
Creation form helpers shouldn't scope fields under the Devise resource
since those fields (like :name) are passkey/security key attributes, not
account attributes. Only login_with_passkey_form_for needs the scope so
that f.check_box :remember_me generates account[remember_me].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: move changelog entry from Fixed to Added
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent fe11674 commit c723131
4 files changed
Lines changed: 9 additions & 6 deletions
File tree
- lib/devise/webauthn/helpers
- spec
- helpers/devise/webauthn
- internal/app/views/devise/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments