mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-21 07:02:32 +02:00
Delete apps/OpenSignServer/package-lock.json
This commit is contained in:
@@ -25,7 +25,7 @@ async function sendMail(document, publicUrl) {
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
});
|
||||
let signerMail = document.Placeholders;
|
||||
let signerMail = document.Placeholders?.filter(x => x?.Role !== 'prefill');
|
||||
const senderName = document.ExtUserPtr.Name;
|
||||
const senderEmail = document.ExtUserPtr.Email;
|
||||
|
||||
@@ -109,9 +109,12 @@ async function batchQuery(userId, Documents, Ip, parseConfig, type, publicUrl) {
|
||||
try {
|
||||
const requests = Documents.map(x => {
|
||||
const Signers = x.Signers;
|
||||
const allSigner = x?.Placeholders?.map(
|
||||
item => Signers?.find(e => item?.signerPtr?.objectId === e?.objectId) || item?.signerPtr
|
||||
).filter(signer => Object.keys(signer).length > 0);
|
||||
const placeholders = x?.Placeholders?.filter(p => p?.Role !== 'prefill');
|
||||
const allSigner = placeholders
|
||||
?.map(
|
||||
item => Signers?.find(e => item?.signerPtr?.objectId === e?.objectId) || item?.signerPtr
|
||||
)
|
||||
.filter(signer => Object.keys(signer).length > 0);
|
||||
const date = new Date();
|
||||
const isoDate = date.toISOString();
|
||||
let Acl = { [x.CreatedBy.objectId]: { read: true, write: true } };
|
||||
@@ -140,7 +143,7 @@ async function batchQuery(userId, Documents, Ip, parseConfig, type, publicUrl) {
|
||||
className: x.ExtUserPtr.className,
|
||||
objectId: x.ExtUserPtr?.objectId,
|
||||
},
|
||||
Placeholders: x.Placeholders.map(y =>
|
||||
Placeholders: placeholders.map(y =>
|
||||
y?.signerPtr?.objectId
|
||||
? {
|
||||
...y,
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SignPdf } from '@signpdf/signpdf';
|
||||
import { P12Signer } from '@signpdf/signer-p12';
|
||||
import { pdflibAddPlaceholder } from '@signpdf/placeholder-pdf-lib';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import Parse from 'parse/node.js';
|
||||
import fs from 'node:fs';
|
||||
import dotenv from 'dotenv';
|
||||
import GenerateCertificate from './pdf/GenerateCertificate.js';
|
||||
|
||||
@@ -2,6 +2,7 @@ import AWS from 'aws-sdk';
|
||||
import { useLocal } from '../../Utils.js';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import dotenv from 'dotenv';
|
||||
import { isAuthenticated } from '../../utils/AuthUtils.js';
|
||||
dotenv.config({ quiet: true });
|
||||
|
||||
export default function getPresignedUrl(url) {
|
||||
@@ -42,6 +43,7 @@ export async function getSignedUrl(request) {
|
||||
const docId = request.params.docId || '';
|
||||
const templateId = request.params.templateId || '';
|
||||
const url = request.params.url;
|
||||
|
||||
if (docId || templateId) {
|
||||
try {
|
||||
if (url?.includes('files')) {
|
||||
@@ -56,8 +58,14 @@ export async function getSignedUrl(request) {
|
||||
|
||||
const _resDoc = res?.toJSON();
|
||||
// Ensure user is authenticated if OTP is required
|
||||
if (_resDoc?.IsEnableOTP && !request?.user) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||
if (_resDoc?.IsEnableOTP) {
|
||||
const isAuth = await isAuthenticated(request?.user);
|
||||
if (!isAuth) {
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_SESSION_TOKEN,
|
||||
'User is not authenticated.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const presignedUrl = getPresignedUrl(url);
|
||||
@@ -70,7 +78,8 @@ export async function getSignedUrl(request) {
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
if (!request?.user) {
|
||||
const isAuth = await isAuthenticated(request?.user);
|
||||
if (!isAuth) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||
} else {
|
||||
if (url?.includes('files')) {
|
||||
|
||||
@@ -56,6 +56,7 @@ export default async function saveAsTemplate(request) {
|
||||
pos: pageItem.pos.map(p => ({
|
||||
...p,
|
||||
type: p.type === 'text' ? 'text input' : p.type,
|
||||
signatureType: '',
|
||||
options: {
|
||||
...p.options,
|
||||
status: 'required',
|
||||
@@ -92,6 +93,7 @@ export default async function saveAsTemplate(request) {
|
||||
if (widget.options && widget.options.defaultValue !== undefined) {
|
||||
return {
|
||||
...widget,
|
||||
signatureType: '',
|
||||
options: {
|
||||
...widget.options,
|
||||
defaultValue: '',
|
||||
|
||||
Reference in New Issue
Block a user