44module Devise
55 module Webauthn
66 module CredentialsHelper
7- def passkey_creation_form_for ( resource , form_classes : nil , &block )
7+ def passkey_creation_form_for ( resource_name , form_classes : nil , &block )
88 form_with (
9- url : passkeys_path ( resource ) ,
9+ url : passkeys_path ( resource_name ) ,
1010 method : :post ,
1111 class : form_classes
1212 ) do |f |
13- tag . webauthn_create ( data : { options_url : passkey_registration_options_path ( resource ) } ) do
13+ tag . webauthn_create ( data : { options_url : passkey_registration_options_path ( resource_name ) } ) do
1414 concat f . hidden_field ( :public_key_credential , data : { webauthn_target : "response" } )
1515 concat capture ( f , &block )
1616 end
1717 end
1818 end
1919
20- def login_with_passkey_button ( text = nil , session_path :, button_classes : nil , form_classes : nil , &block )
20+ def login_with_passkey_button_for ( resource_name , text = nil , session_path :, button_classes : nil ,
21+ form_classes : nil , &block )
2122 form_with (
2223 url : session_path ,
2324 method : :post ,
@@ -31,28 +32,28 @@ def login_with_passkey_button(text = nil, session_path:, button_classes: nil, fo
3132 end
3233 end
3334
34- def security_key_creation_form_for ( resource , form_classes : nil , &block )
35+ def security_key_creation_form_for ( resource_name , form_classes : nil , &block )
3536 form_with (
36- url : second_factor_webauthn_credentials_path ( resource ) ,
37+ url : second_factor_webauthn_credentials_path ( resource_name ) ,
3738 method : :post ,
3839 class : form_classes
3940 ) do |f |
4041 tag . webauthn_create (
41- data : { options_url : security_key_registration_options_path ( resource ) }
42+ data : { options_url : security_key_registration_options_path ( resource_name ) }
4243 ) do
4344 concat f . hidden_field ( :public_key_credential , data : { webauthn_target : "response" } )
4445 concat capture ( f , &block )
4546 end
4647 end
4748 end
4849
49- def login_with_security_key_button ( text = nil , resource : , button_classes : nil , form_classes : nil , &block )
50+ def login_with_security_key_button_for ( resource_name , text = nil , button_classes : nil , form_classes : nil , &block )
5051 form_with (
51- url : two_factor_authentication_path ( resource ) ,
52+ url : two_factor_authentication_path ( resource_name ) ,
5253 method : :post ,
5354 class : form_classes
5455 ) do |f |
55- tag . webauthn_get ( data : { options_url : security_key_authentication_options_path ( resource ) } ) do
56+ tag . webauthn_get ( data : { options_url : security_key_authentication_options_path ( resource_name ) } ) do
5657 concat f . hidden_field ( :public_key_credential , data : { webauthn_target : "response" } )
5758 concat f . button ( text , type : "submit" , class : button_classes , &block )
5859 end
0 commit comments