Class: Erb::Generators::WebauthnAuthenticationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Erb::Generators::WebauthnAuthenticationGenerator
- Defined in:
- lib/generators/erb/webauthn_authentication/webauthn_authentication_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_files ⇒ Object
9 10 11 12 13 |
# File 'lib/generators/erb/webauthn_authentication/webauthn_authentication_generator.rb', line 9 def create_files template "app/views/passkeys/new.html.erb.tt" template "app/views/second_factor_authentications/new.html.erb.tt" template "app/views/second_factor_webauthn_credentials/new.html.erb.tt" end |
#inject_into_rails_session_view ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/erb/webauthn_authentication/webauthn_authentication_generator.rb', line 15 def inject_into_rails_session_view append_to_file "app/views/sessions/new.html.erb" do <<-ERB.strip_heredoc <%= form_with( scope: :session, url: webauthn_session_path, method: :post, data: { controller: "webauthn-credentials", action: "webauthn-credentials#get:prevent", "webauthn-credentials-options-url-value": get_options_webauthn_session_path, }) do |f| %> <%= f.hidden_field :public_key_credential, data: { "webauthn-credentials-target": "credentialHiddenInput" } %> <%= f.submit "Sign In with Passkey", disabled: true, data: { "webauthn-credentials-target": "submitButton" } %> <% end %> ERB end end |