Module: Devise::Webauthn::CredentialsHelper
- Defined in:
- lib/devise/webauthn/helpers/credentials_helper.rb
Instance Method Summary collapse
- #login_with_passkey_form_for(resource_or_resource_name, **options, &block) ⇒ Object
- #login_with_security_key_form_for(resource_or_resource_name, **options, &block) ⇒ Object
- #passkey_creation_form_for(resource_or_resource_name, **options, &block) ⇒ Object
- #security_key_creation_form_for(resource_or_resource_name, **options, &block) ⇒ Object
Instance Method Details
#login_with_passkey_form_for(resource_or_resource_name, **options, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/devise/webauthn/helpers/credentials_helper.rb', line 17 def login_with_passkey_form_for(resource_or_resource_name, **, &block) scope = Devise::Mapping.find_scope!(resource_or_resource_name) form_with( **, scope: scope, url: session_path(resource_or_resource_name), method: :post ) do |f| tag.webauthn_get(data: { options_url: (resource_or_resource_name) }) do concat hidden_field_tag(:public_key_credential, nil, data: { webauthn_target: "response" }) concat capture(f, &block) end end end |
#login_with_security_key_form_for(resource_or_resource_name, **options, &block) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/devise/webauthn/helpers/credentials_helper.rb', line 43 def login_with_security_key_form_for(resource_or_resource_name, **, &block) form_with( **, url: two_factor_authentication_path(resource_or_resource_name), method: :post ) do |f| tag.webauthn_get(data: { options_url: (resource_or_resource_name) }) do concat f.hidden_field(:public_key_credential, data: { webauthn_target: "response" }) concat capture(f, &block) end end end |
#passkey_creation_form_for(resource_or_resource_name, **options, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/devise/webauthn/helpers/credentials_helper.rb', line 6 def passkey_creation_form_for(resource_or_resource_name, **, &block) form_with( **, url: passkeys_path(resource_or_resource_name), method: :post ) do |f| tag.webauthn_create(data: { options_url: (resource_or_resource_name) }) do concat f.hidden_field(:public_key_credential, data: { webauthn_target: "response" }) concat capture(f, &block) end end end |
#security_key_creation_form_for(resource_or_resource_name, **options, &block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/devise/webauthn/helpers/credentials_helper.rb', line 30 def security_key_creation_form_for(resource_or_resource_name, **, &block) form_with( **, url: second_factor_webauthn_credentials_path(resource_or_resource_name), method: :post ) do |f| tag.webauthn_create( data: { options_url: (resource_or_resource_name) } ) do concat f.hidden_field(:public_key_credential, data: { webauthn_target: "response" }) concat capture(f, &block) end end end |