2023-08-31 01:12:24 +03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class VerifyPdfSignatureController < ApplicationController
|
2023-09-17 00:45:57 +03:00
|
|
|
skip_authorization_check
|
|
|
|
|
|
2023-08-31 01:12:24 +03:00
|
|
|
def create
|
|
|
|
|
pdfs =
|
|
|
|
|
params[:files].map do |file|
|
|
|
|
|
HexaPDF::Document.new(io: file.open)
|
|
|
|
|
end
|
|
|
|
|
|
2024-08-08 00:12:50 +03:00
|
|
|
trusted_certs = Accounts.load_trusted_certs(current_account)
|
2023-08-31 01:12:24 +03:00
|
|
|
|
|
|
|
|
render turbo_stream: turbo_stream.replace('result', partial: 'result',
|
|
|
|
|
locals: { pdfs:, files: params[:files], trusted_certs: })
|
|
|
|
|
rescue HexaPDF::MalformedPDFError
|
2024-09-18 19:47:47 +03:00
|
|
|
render turbo_stream: turbo_stream.replace('result', html: helpers.tag.div(I18n.t('invalid_pdf'), id: 'result'))
|
2023-08-31 01:12:24 +03:00
|
|
|
end
|
|
|
|
|
end
|