Implement Passkey authentication
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
<tr style="view-transition-name: <%= dom_id(credential) %>">
|
||||
<td><strong><%= credential.name.presence || "Passkey" %></strong></td>
|
||||
<td class="txt-nowrap"><%= local_datetime_tag credential.created_at, style: :datetime %></td>
|
||||
<td>
|
||||
<%= button_to user_credential_path(@user, credential), method: :delete,
|
||||
<%= button_to user_credential_path(Current.user, credential), method: :delete,
|
||||
class: "btn btn--circle txt-negative txt-xx-small borderless",
|
||||
data: { turbo_confirm: "Are you sure you want to remove this passkey?" } do %>
|
||||
<%= icon_tag "trash" %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<% content_for :header do %>
|
||||
<div class="header__actions header__actions--start">
|
||||
<%= back_link_to "My profile", user_path(@user), "keydown.left@document->hotkey#click keydown.esc@document->hotkey#click" %>
|
||||
<%= back_link_to "My profile", user_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>
|
||||
@@ -16,7 +16,6 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Passkey</th>
|
||||
<th>Created</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -26,7 +25,7 @@
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<%= link_to new_user_credential_path(@user), class: "btn btn--link" do %>
|
||||
<%= link_to new_user_credential_path(Current.user), class: "btn btn--link" do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span>Add a passkey</span>
|
||||
<% end %>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
<% 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" %>
|
||||
<%= 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(@user),
|
||||
<%= 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| %>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<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">
|
||||
<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" %>
|
||||
@@ -27,5 +27,5 @@
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "Cancel and go back", user_credentials_path(@user), hidden: true %>
|
||||
<%= link_to "Cancel and go back", user_credentials_path(Current.user), hidden: true %>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user