Files
fizzy/app/views/users/credentials/new.html.erb
T
Stanko K.R. 6c58fd9bdd Implement Passkey registration
- Create Identity credentials
- Add management UI and registration flow
2026-03-18 11:48:52 +01:00

33 lines
1.5 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(@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 %>
<article class="panel panel--wide shadow center txt-align-start">
<%= form_with url: user_credentials_path(@user),
data: { controller: "credential", credential_public_key_value: @creation_options.as_json },
html: { class: "flex flex-column gap" } do |form| %>
<p>A passkey lets you sign in using your device's biometrics, PIN, or security key — no email code needed.</p>
<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[response][client_data_json]" data-credential-target="clientDataJSON">
<input type="hidden" name="credential[response][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(@user), hidden: true %>
</article>