Skip to content

Open-source document signature platform. Not affiliated with DocuSign.

TypeScript

Fix the second review round on embedded signing

Claude90a0e82a9791
diff --git a/src/lib/envelope-schedule.ts b/src/lib/envelope-schedule.ts
index 871492c..8e96c78 100644
--- a/src/lib/envelope-schedule.ts
+++ b/src/lib/envelope-schedule.ts
@@ -236,6 +236,9 @@ async function listEnvelopesDueForReminder(
ON s.envelope_id = e.id
AND s.status = 'notified'
WHERE e.status = 'sent'
+ -- Embedded envelopes get no reminders; left out here, before the
+ -- batch limit, so they cannot fill every batch.
+ AND e.delivery = 'email'
AND e.reminder_interval_days IS NOT NULL
AND (e.expires_at IS NULL OR e.expires_at > $1)
AND GREATEST(
diff --git a/src/lib/envelopes.ts b/src/lib/envelopes.ts
index 8add4c9..c06dfad 100644
--- a/src/lib/envelopes.ts
+++ b/src/lib/envelopes.ts
@@ -2548,6 +2548,24 @@ export async function sendDraftEnvelope(
);
}
+ // Access codes and emailed codes are not part of that snapshot, and
+ // an embedded signer has no way to enter one. Checked again here,
+ // under the same lock that a save of the signers takes.
+ if (delivery === "embedded") {
+ const lockedChecks = await listSignerCheckSettings(envelopeId, tx);
+
+ if (
+ [...lockedChecks.values()].some(
+ (check) => check.hasAccessCode || check.requireEmailCode,
+ )
+ ) {
+ throw new EnvelopeMutationError(
+ "Embedded signers are identified by your app, so leave out access codes and emailed codes.",
+ 400,
+ );
+ }
+ }
+
await tx.query(
`
UPDATE signers