<%# Signing form: review, certificate, re-authentication, confirm. Locals: entry, url, cancel_path. %>

Sign this entry

Review the entry: your signature will cover exactly what's shown here, and it can't be changed afterwards. A mistake is fixed with a correction entry.

<%= render "logbook_entries/content", entry: entry %> <% if @signing_error %> <% end %> <% if @certificates.empty? %>

To sign, add your certificate on <%= link_to "your profile", edit_profile_path(anchor: "certificates"), class: "link" %>.

<% else %> <%= form_with url: url, method: :post, class: "space-y-4" do %>
Sign with <% @certificates.each_with_index do |c, i| %> <% problems = entry.signing_problems(c) %> <% end %>
<% if Sso.password_login? || !current_user.sso_uid? %>
<%= label_tag :password, "Your password", class: "label" %> <%= password_field_tag :password, nil, class: "input", autocomplete: "current-password" %>

Proves it's you signing, not someone at your keyboard.<%= " Or sign in again with #{Sso.label} below." if Sso.enabled? && current_user.sso_uid? %>

<% end %> <% if Sso.enabled? && current_user.sso_uid? %> <% fresh = session[:reauthenticated_at] && Time.zone.at(session[:reauthenticated_at]) > EntrySigner::REAUTH_WINDOW.ago %>

<%= fresh ? "Signed in again with #{Sso.label}: you can sign now." : "Or sign in again with #{Sso.label} first (button below the form)." %>

<% end %>
<%= submit_tag "Sign entry", class: "btn-primary" %><%= link_to "Cancel", cancel_path, class: "btn-secondary" %>
<% end %> <% if Sso.enabled? && current_user.sso_uid? %> <%= button_to "Sign in again with #{Sso.label}", "/auth/#{Sso::PROVIDER}", params: { prompt: "login" }, class: "btn-secondary btn-sm", data: { turbo: false } %> <% end %> <% end %>