add signature verification
@@ -0,0 +1,68 @@
|
||||
<div id="result">
|
||||
<% blobs.zip(pdfs).each do |blob, pdf| %>
|
||||
<div class="mb-4 border border-base-300 rounded-md py-2 px-3">
|
||||
<% if pdf.signatures.to_a.size == 0 %>
|
||||
<div class="text-sm">
|
||||
<%= blob.filename %>
|
||||
</div>
|
||||
<p class="text-xl font-medium">
|
||||
There are no signatures...
|
||||
</p>
|
||||
<% else %>
|
||||
<div class="flex items-center space-x-1 border-b border-dashed border-base-300 pb-2">
|
||||
<%= svg_icon('file_text', class: 'w-5 h-5 inline') %>
|
||||
<span><%= blob.filename %> - <%= pluralize(pdf.signatures.to_a.size, 'Signature') %></span>
|
||||
</div>
|
||||
<% pdf.signatures.to_a.each do |signature| %>
|
||||
<div class="mt-3">
|
||||
<div class="space-y-1 font-medium pb-2 text-xl">
|
||||
<% signature.verify(trusted_certs:).messages.map(&:content).each do |message| %>
|
||||
<p class="flex space-x-1 items-center">
|
||||
<% if message == 'Signature verification failed' %>
|
||||
<%= svg_icon('x_circle', class: 'w-6 h-6 text-red-500') %>
|
||||
<% elsif message == 'Signature valid' %>
|
||||
<%= svg_icon('circle_check', class: 'w-6 h-6 text-green-500') %>
|
||||
<% end %>
|
||||
<span>
|
||||
<%= message %>
|
||||
</span>
|
||||
</p>
|
||||
<% if message == 'Signature valid' %>
|
||||
<p class="flex space-x-1 items-center">
|
||||
<% if signature.signature_handler.signer_certificate.public_key.to_der == trusted_certs.first.public_key.to_der %>
|
||||
<%= svg_icon('circle_check', class: 'w-6 h-6 text-green-500') %>
|
||||
<span>
|
||||
Signed with DocuSeal Certificate
|
||||
</span>
|
||||
<% else %>
|
||||
<%= svg_icon('x_circle', class: 'w-6 h-6 text-red-500') %>
|
||||
<span>
|
||||
Signed with External Certificate
|
||||
</span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex items-center space-x-1">
|
||||
<%= svg_icon('user', class: 'w-5 h-5 inline') %>
|
||||
<span><%= signature.signing_reason %></span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-1">
|
||||
<%= svg_icon('calendar', class: 'w-5 h-5 inline') %>
|
||||
<span><%= l(signature.signing_time, format: :long) %></span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-1">
|
||||
<%= svg_icon('certificate', class: 'w-5 h-5 inline') %>
|
||||
<span><%= signature.signer_name %></span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-1">
|
||||
<%= svg_icon('lock_access', class: 'w-5 h-5 inline') %>
|
||||
<span><%= signature.signature_type %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,19 +1,40 @@
|
||||
<div class="flex flex-wrap space-y-4 md:flex-nowrap md:space-y-0">
|
||||
<%= render 'shared/settings_nav' %>
|
||||
<div class="flex-grow max-w-xl mx-auto">
|
||||
<h1 class="text-4xl font-bold mb-4">eSign</h1>
|
||||
<p>
|
||||
Upload your electronic signature
|
||||
</p>
|
||||
<h1 class="text-4xl font-bold mb-4">Verify PDF Signature</h1>
|
||||
<div id="result">
|
||||
<p class="mb-2">
|
||||
Upload signed PDF file to validate its signature:
|
||||
</p>
|
||||
</div>
|
||||
<%= form_for '', url: settings_esign_index_path, method: :post do |f| %>
|
||||
<file-dropzone data-name="verify_attachments" class="">
|
||||
<label for="file">
|
||||
<input id="attachment_uuid" name="attachment_uuid" class="hidden" data-target="file-dropzone.valueField" type="text" autocomplete="off">
|
||||
<input id="file" class="hidden" data-action="change:file-dropzone#onSelectFiles" data-target="file-dropzone.input" type="file">
|
||||
Cick to upload
|
||||
<%= f.button type: 'submit', class: 'flex' do %>
|
||||
<div class="disabled mb-3">
|
||||
<%= svg_icon('loader', class: 'w-5 h-5 animate-spin inline') %>
|
||||
Analyzing...
|
||||
</div>
|
||||
<% end %>
|
||||
<file-dropzone data-name="verify_attachments" data-submit-on-upload="true" class="w-full">
|
||||
<label for="file" class="w-full block h-32 relative bg-base-300 hover:bg-base-200 rounded-md border border-base-content border-dashed">
|
||||
<div class="absolute top-0 right-0 left-0 bottom-0 flex items-center justify-center">
|
||||
<div class="flex flex-col items-center">
|
||||
<span data-target="file-dropzone.icon">
|
||||
<%= svg_icon('cloud_upload', class: 'w-10 h-10') %>
|
||||
</span>
|
||||
<span data-target="file-dropzone.loading" class="hidden">
|
||||
<%= svg_icon('loader', class: 'w-10 h-10 animate-spin') %>
|
||||
</span>
|
||||
<div class="font-medium mb-1">
|
||||
Verify Signed PDF
|
||||
</div>
|
||||
<div class="text-xs">
|
||||
<span class="font-medium">Click to upload</span> or drag and drop
|
||||
</div>
|
||||
</div>
|
||||
<input id="file" class="hidden" data-action="change:file-dropzone#onSelectFiles" data-target="file-dropzone.input" type="file" accept="application/pdf" multiple>
|
||||
</div>
|
||||
</label>
|
||||
</file-dropzone>
|
||||
<%= f.button button_title(title: 'Save', disabled_with: 'Saving') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="w-0 md:w-52"></div>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M15 15m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
|
||||
<path d="M13 17.5v4.5l2 -1.5l2 1.5v-4.5"></path>
|
||||
<path d="M10 19h-5a2 2 0 0 1 -2 -2v-10c0 -1.1 .9 -2 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -1 1.73"></path>
|
||||
<path d="M6 9l12 0"></path>
|
||||
<path d="M6 12l3 0"></path>
|
||||
<path d="M6 15l2 0"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 603 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path>
|
||||
<path d="M9 12l2 2l4 -4"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 389 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1"></path>
|
||||
<path d="M9 15l3 -3l3 3"></path>
|
||||
<path d="M12 12l0 9"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 443 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M14 3v4a1 1 0 0 0 1 1h4"></path>
|
||||
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path>
|
||||
<path d="M9 9l1 0"></path>
|
||||
<path d="M9 13l6 0"></path>
|
||||
<path d="M9 17l6 0"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 518 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M4 8v-2a2 2 0 0 1 2 -2h2"></path>
|
||||
<path d="M4 16v2a2 2 0 0 0 2 2h2"></path>
|
||||
<path d="M16 4h2a2 2 0 0 1 2 2v2"></path>
|
||||
<path d="M16 20h2a2 2 0 0 0 2 -2v-2"></path>
|
||||
<path d="M8 11m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"></path>
|
||||
<path d="M10 11v-2a2 2 0 1 1 4 0v2"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 619 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"></path>
|
||||
<path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 407 B |
@@ -1 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path>
|
||||
<path d="M10 10l4 4m0 -4l-4 4"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 395 B |