Files
fizzy/app/views/users/credentials/new.html.erb
T
2026-03-18 11:49:23 +01:00

32 lines
1.4 KiB
Plaintext

<% @page_title = "Add a passkey" %>
<% content_for :header do %>
<div class="header__actions header__actions--start">
<%= back_link_to "Passkeys", user_credentials_path(Current.user), "keydown.left@document->hotkey#click keydown.esc@document->hotkey#click" %>
</div>
<h1 class="header__title" data-bridge--title-target="header"><%= @page_title %></h1>
<% end %>
<section class="panel panel--wide shadow center txt-align-start">
<%= form_with url: user_credentials_path(Current.user),
data: { controller: "credential", credential_public_key_value: @creation_options.as_json },
html: { class: "flex flex-column gap" } do |form| %>
<div class="flex flex-column gap-half">
<strong><label for="credential_name">Passkey name</label></strong>
<input type="text" id="credential_name" name="credential[name]" required autofocus class="input" placeholder="e.g. MacBook Pro, iPhone">
</div>
<input type="hidden" name="credential[client_data_json]" data-credential-target="clientDataJSON">
<input type="hidden" name="credential[attestation_object]" data-credential-target="attestationObject">
<button type="button" data-action="credential#create" class="btn btn--link center txt-medium">
<%= icon_tag "add" %>
<span>Register passkey</span>
</button>
<% end %>
<%= link_to "Cancel and go back", user_credentials_path(Current.user), hidden: true %>
</section>