mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
feat: expiry links
This commit is contained in:
@ -25,7 +25,9 @@ import {
|
||||
} from '../../types/field-meta';
|
||||
import type { RequestMetadata } from '../../universal/extract-request-metadata';
|
||||
import { createDocumentAuditLogData } from '../../utils/document-audit-logs';
|
||||
import { isRecipientExpired } from '../../utils/expiry';
|
||||
import { validateFieldAuth } from '../document/validate-field-auth';
|
||||
import { expireRecipient } from '../recipient/expire-recipient';
|
||||
|
||||
export type SignFieldWithTokenOptions = {
|
||||
token: string;
|
||||
@ -115,6 +117,11 @@ export const signFieldWithToken = async ({
|
||||
throw new Error(`Recipient ${recipient.id} has already signed`);
|
||||
}
|
||||
|
||||
if (isRecipientExpired(recipient)) {
|
||||
await expireRecipient({ recipientId: recipient.id });
|
||||
throw new Error(`Signing link has expired`);
|
||||
}
|
||||
|
||||
if (field.inserted) {
|
||||
throw new Error(`Field ${fieldId} has already been inserted`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user