mirror of https://github.com/docusealco/docuseal
Adds an admin-only 'Correct signature' button on completed submitters in the submission view. It clears the submitter's existing signature (documents, attachments and field values), reopens their form, and re-sends the invitation email so they can sign again — useful when a signature was made incorrectly. - New SubmittersResetSignatureController#update (authorized via :update) - New route: resources :submitters_reset_signature, only: [:update] - Button in submissions/show.html.erb for completed submitters (with confirm) - EN/ES i18n strings Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>pull/716/head
parent
004a22c1c8
commit
2e0f3da247
@ -0,0 +1,30 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SubmittersResetSignatureController < ApplicationController
|
||||||
|
load_and_authorize_resource :submitter, parent: false
|
||||||
|
|
||||||
|
def update
|
||||||
|
authorize!(:update, @submitter)
|
||||||
|
|
||||||
|
if @submitter.completed_at.blank?
|
||||||
|
return redirect_back(fallback_location: submission_path(@submitter.submission),
|
||||||
|
alert: I18n.t('signature_has_not_been_completed_yet'))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove the previously generated signature artifacts.
|
||||||
|
@submitter.documents.purge
|
||||||
|
@submitter.attachments.purge
|
||||||
|
@submitter.preview_documents.purge
|
||||||
|
|
||||||
|
# Re-open the submitter's form so they can sign again from scratch.
|
||||||
|
@submitter.update!(completed_at: nil, opened_at: nil, declined_at: nil, values: {})
|
||||||
|
|
||||||
|
# Email the signer a fresh invitation to correct their signature.
|
||||||
|
SendSubmitterInvitationEmailJob.perform_async('submitter_id' => @submitter.id)
|
||||||
|
|
||||||
|
@submitter.update!(sent_at: Time.current)
|
||||||
|
|
||||||
|
redirect_back(fallback_location: submission_path(@submitter.submission),
|
||||||
|
notice: I18n.t('correction_request_has_been_sent'))
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in new issue