mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Electronic signatures on logbook entries (AC 120-78B chapter 2)
- Sign an entry: review exactly what's certified, choose a current certificate (eligibility checked: pilot only for preventive maintenance, inspections need their result and time), re-enter the password or sign in again with SSO (prompt=login, within 5 minutes), and confirm the "Certified by" statement (43.9 return to service, 43.11(a)(5) for inspections, preventive maintenance for pilots) - The signature stores signer, certificate, statement, UTC time, how they authenticated, IP/browser, a SHA-256 fingerprint of the entry's content and a readable snapshot; an HMAC seal covers the signature record. Status shows Valid / Superseded / Altered since signing. The signer is emailed - Signed entries (and their sub-components) can't be edited or deleted; a correction entry, once signed, supersedes the original (kept) - Owners invite an outside mechanic by email to sign one entry: one-time, 14-day link; they create or use their own account and certificate and see only that entry - Admins can disable accounts (signed out, can't sign in or sign; past signatures kept); users with signatures can't be deleted - Printouts show the electronic signature and fingerprint; archives carry signatures (marked imported, with their origin) and corrections Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7caa213e7a
commit
d719f663bc
47 files changed
+1059
-17
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<%# Signing form: review, certificate, re-authentication, confirm. Locals: entry, url, cancel_path. %>
|
||||
<section class="card max-w-3xl">
|
||||
<div class="card-header"><h2 class="card-title">Sign this entry</h2></div>
|
||||
<div class="card-body space-y-4">
|
||||
<p class="text-sm text-slate-600">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.</p>
|
||||
<%= render "logbook_entries/content", entry: entry %>
|
||||
<% if @signing_error %>
|
||||
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert"><%= @signing_error %></div>
|
||||
<% end %>
|
||||
<% if @certificates.empty? %>
|
||||
<p class="rounded-md bg-amber-50 p-3 text-sm text-amber-900 ring-1 ring-amber-200">
|
||||
To sign, add your certificate on <%= link_to "your profile", edit_profile_path(anchor: "certificates"), class: "link" %>.
|
||||
</p>
|
||||
<% else %>
|
||||
<%= form_with url: url, method: :post, class: "space-y-4" do %>
|
||||
<fieldset class="space-y-2">
|
||||
<legend class="label">Sign with</legend>
|
||||
<% @certificates.each_with_index do |c, i| %>
|
||||
<% problems = entry.signing_problems(c) %>
|
||||
<label class="flex items-start gap-2 rounded-md p-2 text-sm ring-1 ring-slate-200 <%= 'opacity-60' if problems.any? %>">
|
||||
<%= radio_button_tag :certificate_id, c.id, params[:certificate_id].to_s == c.id.to_s || (params[:certificate_id].blank? && i.zero? && problems.empty?),
|
||||
disabled: problems.any?, class: "mt-1" %>
|
||||
<span><strong><%= current_user.display_name %>, <%= c.kind_label %> <%= c.number %></strong>
|
||||
<% if problems.any? %><span class="block text-xs text-red-700">Can't sign: <%= problems.to_sentence %>.</span>
|
||||
<% else %><span class="block text-slate-600"><%= EntrySignature::LABEL %>: “<%= entry.certification_statement(c.kind) %>”</span><% end %></span>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% if Sso.password_login? || !current_user.sso_uid? %>
|
||||
<div class="max-w-xs">
|
||||
<%= label_tag :password, "Your password", class: "label" %>
|
||||
<%= password_field_tag :password, nil, class: "input", autocomplete: "current-password" %>
|
||||
<p class="hint">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? %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if Sso.enabled? && current_user.sso_uid? %>
|
||||
<% fresh = session[:reauthenticated_at] && Time.zone.at(session[:reauthenticated_at]) > EntrySigner::REAUTH_WINDOW.ago %>
|
||||
<p class="text-sm <%= fresh ? 'text-emerald-700' : 'text-slate-600' %>"><%= fresh ? "Signed in again with #{Sso.label}: you can sign now." : "Or sign in again with #{Sso.label} first (button below the form)." %></p>
|
||||
<% end %>
|
||||
<label class="flex items-start gap-2 text-sm">
|
||||
<%= check_box_tag :confirm, "1", false, class: "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300" %>
|
||||
<span>I am signing this entry myself, with the intent to sign it, and certify the statement above.</span>
|
||||
</label>
|
||||
<div class="flex gap-2"><%= submit_tag "Sign entry", class: "btn-primary" %><%= link_to "Cancel", cancel_path, class: "btn-secondary" %></div>
|
||||
<% 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 %>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user