Choice of passkey or password for authentication #290
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could try always rendering the same verify account view, and require different things depending on a query param. I haven't tested this, but something like: verify_account_view do
view("verify-account", verify_account_page_title)
end
verify_account_set_password? { param("factor") == "password" } <!-- app/views/rodauth/verify_account.html.erb -->
<% case params[:factor] %>
<% when "password" %>
<%= form_with url: rodauth.verify_account_path, method: :post do |form| %>
<%= form.password_field rodauth.password_param, ... %>
<%= form.password_field rodauth.password_confirm_param, ... %>
<%= form.submit "Set Password" %>
<% end %>
<% when "webauthn" %>
<%= rodauth.render("webauthn-setup") %> <!-- render WebAuthn setup form -->
<% else %>
<%= link_to "Set Password", rodauth.verify_account_path(factor: "password") %>
<%= link_to "Create Passkey", rodauth.verify_account_path(factor: "webauthn") %>
<% end %> The verify account token should still be valid here, because it's stored into the session on initial page load (taken from the query param in the email link). |
Beta Was this translation helpful? Give feedback.
You could try always rendering the same verify account view, and require different things depending on a query param. I haven't tested this, but something like: