Rename create_options to registration_options

This commit is contained in:
Stanko K.R.
2026-03-25 16:21:38 +01:00
parent 8e4f9ce5e7
commit df7c2678f3
7 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -5,11 +5,11 @@ class My::PasskeysController < ApplicationController
def index
@passkeys = Current.identity.passkeys.order(name: :asc, created_at: :desc)
@creation_options = passkey_creation_options(holder: Current.identity)
@registration_options = passkey_registration_options(holder: Current.identity)
end
def create
passkey = Current.identity.passkeys.register(passkey_creation_params)
passkey = Current.identity.passkeys.register(passkey_registration_params)
redirect_to edit_my_passkey_path(passkey, created: true)
end
+5 -5
View File
@@ -1,6 +1,6 @@
// Web components for the ActionPack::Passkey Ruby helpers.
//
// <rails-passkey-creation-button> — wraps a registration ceremony form
// <rails-passkey-registration-button> — wraps a registration ceremony form
// <rails-passkey-sign-in-button> — wraps an authentication ceremony form
//
// The Ruby form helpers render the component markup including the inner form,
@@ -92,13 +92,13 @@ class PasskeyButton extends HTMLElement {
}
}
class PasskeyCreationButton extends PasskeyButton {
class PasskeyRegistrationButton extends PasskeyButton {
async perform(options) {
return await register(options)
}
fillForm(passkey) {
fillCreateForm(this.form, passkey)
fillRegistrationForm(this.form, passkey)
}
}
@@ -148,7 +148,7 @@ class PasskeySignInButton extends PasskeyButton {
}
}
customElements.define("rails-passkey-creation-button", PasskeyCreationButton)
customElements.define("rails-passkey-registration-button", PasskeyRegistrationButton)
customElements.define("rails-passkey-sign-in-button", PasskeySignInButton)
// -- Shared helpers ----------------------------------------------------------
@@ -176,7 +176,7 @@ async function refreshChallenge(options, challengeUrl) {
options.challenge = challenge
}
function fillCreateForm(form, passkey) {
function fillRegistrationForm(form, passkey) {
form.querySelector('[data-passkey-field="client_data_json"]').value = passkey.client_data_json
form.querySelector('[data-passkey-field="attestation_object"]').value = passkey.attestation_object
+1 -1
View File
@@ -18,7 +18,7 @@
<% end %>
<footer>
<%= passkey_creation_button my_passkeys_path, options: @creation_options, error: { class: "txt-negative" }, cancellation: { class: "txt-subtle" }, class: "btn btn--link center txt-medium" do %>
<%= passkey_registration_button my_passkeys_path, options: @registration_options, error: { class: "txt-negative" }, cancellation: { class: "txt-subtle" }, class: "btn btn--link center txt-medium" do %>
<%= icon_tag "add" %>
<span>Register a passkey</span>
<% end %>