🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
refactor: change variable from isDisableOTP to isEnableOTP
prafull-opensignlabs4caf9f598a6e
diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.jsonindex cfd1f51a5..c3d3d88f7 100644--- a/apps/OpenSign/public/locales/en/translation.json+++ b/apps/OpenSign/public/locales/en/translation.json@@ -639,8 +639,8 @@"sent-this-month":"Sent this month","available-seats":"Available seats","buy-users":"Buy more users",- "isdisable-otp": "Enable OTP verification",- "isdisable-otp-help": {+ "isenable-otp": "Enable OTP verification",+ "isenable-otp-help": {"p1": "Would you like to enable the verification process using a one-time password (OTP)?","p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.","p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.jsonindex 9c13f9e2b..3d5114f43 100644--- a/apps/OpenSign/public/locales/fr/translation.json+++ b/apps/OpenSign/public/locales/fr/translation.json@@ -638,8 +638,8 @@"sent-this-month":"envoyé ce mois-ci","available-seats":"Disponible sièges","buy-users":"Acheter plus d'utilisateurs",- "isdisable-otp": "Activer la vérification OTP",- "isdisable-otp-help": {+ "isenable-otp": "Activer la vérification OTP",+ "isenable-otp-help": {"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?","p2": "La sélection de cette option activera la vérification OTP. Les utilisateurs recevront un code de vérification par e-mail, qu'ils devront saisir pour signer le document.","p3": "La sélection de cette option désactivera la vérification OTP, permettant aux utilisateurs de signer le document directement sans étapes supplémentaires.",diff --git a/apps/OpenSign/src/components/pdf/EditTemplate.js b/apps/OpenSign/src/components/pdf/EditTemplate.jsindex adf480218..2a8fd6574 100644--- a/apps/OpenSign/src/components/pdf/EditTemplate.js+++ b/apps/OpenSign/src/components/pdf/EditTemplate.js@@ -3,6 +3,8 @@ import { checkIsSubscribed, getFileName } from "../../constant/Utils";import Upgrade from "../../primitives/Upgrade";import { isEnableSubscription } from "../../constant/const";import { useTranslation } from "react-i18next";+import { Tooltip } from "react-tooltip";+// import SelectFolder from "../../premitives/SelectFolder";const EditTemplate = ({ template, onSuccess }) => {@@ -14,7 +16,8 @@ const EditTemplate = ({ template, onSuccess }) => {Description: template?.Description || "",SendinOrder: template?.SendinOrder ? `${template?.SendinOrder}` : "false",AutomaticReminders: template?.AutomaticReminders || false,- RemindOnceInEvery: template?.RemindOnceInEvery || 5+ RemindOnceInEvery: template?.RemindOnceInEvery || 5,+ IsEnableOTP: template?.IsEnableOTP ? `${template?.IsEnableOTP}` : "false"});const [isSubscribe, setIsSubscribe] = useState(false);useEffect(() => {@@ -184,6 +187,70 @@ const EditTemplate = ({ template, onSuccess }) => {/></div>)}+ {isEnableSubscription && (+ <div className="text-xs mt-2">+ <label className="block">+ <span className={isSubscribe ? "" : " text-gray-300"}>+ {t("isenable-otp")}{" "}+ <a data-tooltip-id="isenableotp-tooltip" className="ml-1">+ <sup>+ <i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>+ </sup>+ </a>{" "}+ {!isSubscribe && isEnableSubscription && <Upgrade />}+ </span>+ <Tooltip id="isenableotp-tooltip" className="z-50">+ <div className="max-w-[200px] md:max-w-[450px]">+ <p className="font-bold">{t("isenable-otp")}</p>+ <p>{t("isenable-otp-help.p1")}</p>+ <p className="p-[5px]">+ <ol className="list-disc">+ <li>+ <span className="font-bold">{t("yes")}: </span>+ <span>{t("isenable-otp-help.p2")}</span>+ </li>+ <li>+ <span className="font-bold">{t("no")}: </span>+ <span>{t("isenable-otp-help.p3")}</span>+ </li>+ </ol>+ </p>+ <p>{t("isenable-otp-help.p4")}</p>+ </div>+ </Tooltip>+ </label>+ <div+ className={`${+ isSubscribe ? "" : "pointer-events-none opacity-50"+ } flex items-center gap-2 ml-2 mb-1 `}+ >+ <input+ type="radio"+ value={"true"}+ className="op-radio op-radio-xs"+ name="IsEnableOTP"+ checked={formData.IsEnableOTP === "true"}+ onChange={handleStrInput}+ />+ <div className="text-center">{t("yes")}</div>+ </div>+ <div+ className={`${+ isSubscribe ? "" : "pointer-events-none opacity-50"+ } flex items-center gap-2 ml-2 mb-1 `}+ >+ <input+ type="radio"+ value={"false"}+ name="IsEnableOTP"+ className="op-radio op-radio-xs"+ checked={formData.IsEnableOTP === "false"}+ onChange={handleStrInput}+ />+ <div className="text-center">{t("no")}</div>+ </div>+ </div>+ )}<div className="mt-[1rem] flex justify-start"><button type="submit" className="op-btn op-btn-primary">{t("submit")}diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.jsindex 97eb4b5de..a746f982f 100644--- a/apps/OpenSign/src/constant/Utils.js+++ b/apps/OpenSign/src/constant/Utils.js@@ -2045,7 +2045,7 @@ export const handleDownloadPdf = async () => {const pdfName = pdfDetails[0] && pdfDetails[0].Name;setIsDownloading("pdf");- const docId = pdfDetails?.[0]?.IsDisableOTP ? pdfDetails?.[0]?.objectId : "";+ const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";try {// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });const axiosRes = await axios.post(@@ -2082,10 +2082,8 @@ export const handleToPrint = async () => {event.preventDefault();setIsDownloading("pdf");+ const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";try {- const docId = pdfDetails?.[0]?.IsDisableOTP- ? pdfDetails?.[0]?.objectId- : "";// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });//`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign//if we give this `appInfo.baseUrl` as a base url then in public-profile it will create base url of it's window.location.origin ex- opensign.me which is not base urldiff --git a/apps/OpenSign/src/pages/Form.js b/apps/OpenSign/src/pages/Form.jsindex d6a0aef74..4abb65e65 100644--- a/apps/OpenSign/src/pages/Form.js+++ b/apps/OpenSign/src/pages/Form.js@@ -62,7 +62,7 @@ const Forms = (props) => {file: "",remindOnceInEvery: 5,autoreminder: false,- IsDisableOTP: "false"+ IsEnableOTP: "false"});const [fileupload, setFileUpload] = useState("");const [fileload, setfileload] = useState(false);@@ -404,11 +404,11 @@ const Forms = (props) => {object.set("AutomaticReminders", formData.autoreminder);object.set("RemindOnceInEvery", parseInt(formData.remindOnceInEvery));if (isEnableSubscription) {- const IsDisableOTP =- formData.IsDisableOTP === "false" ? true : false;- object.set("IsDisableOTP", IsDisableOTP);+ const IsEnableOTP =+ formData?.IsEnableOTP === "false" ? false : true;+ object.set("IsEnableOTP", IsEnableOTP);} else {- object.set("IsDisableOTP", true);+ object.set("IsEnableOTP", false);}}object.set("URL", fileupload);@@ -446,7 +446,7 @@ const Forms = (props) => {file: "",remindOnceInEvery: 5,autoreminder: false,- IsDisableOTP: "false"+ IsEnableOTP: "false"});setFileUpload("");setpercentage(0);@@ -496,7 +496,7 @@ const Forms = (props) => {file: "",remindOnceInEvery: 5,autoreminder: false,- IsDisableOTP: "false"+ IsEnableOTP: "false"});setFileUpload("");setpercentage(0);@@ -896,9 +896,9 @@ const Forms = (props) => {<div className="text-xs mt-2"><label className="block"><span className={isSubscribe ? "" : " text-gray-300"}>- {t("isdisable-otp")}{" "}+ {t("isenable-otp")}{" "}<a- data-tooltip-id="isdisableotp-tooltip"+ data-tooltip-id="isenableotp-tooltip"className="ml-1"><sup>@@ -909,27 +909,27 @@ const Forms = (props) => {<Upgrade />)}</span>- <Tooltip id="isdisableotp-tooltip" className="z-50">+ <Tooltip id="isenableotp-tooltip" className="z-50"><div className="max-w-[200px] md:max-w-[450px]">- <p className="font-bold">{t("isdisable-otp")}</p>- <p>{t("isdisable-otp-help.p1")}</p>+ <p className="font-bold">{t("isenable-otp")}</p>+ <p>{t("isenable-otp-help.p1")}</p><p className="p-[5px]"><ol className="list-disc"><li><span className="font-bold">{t("yes")}:{" "}</span>- <span>{t("isdisable-otp-help.p2")}</span>+ <span>{t("isenable-otp-help.p2")}</span></li><li><span className="font-bold">{t("no")}:{" "}</span>- <span>{t("isdisable-otp-help.p3")}</span>+ <span>{t("isenable-otp-help.p3")}</span></li></ol></p>- <p>{t("isdisable-otp-help.p4")}</p>+ <p>{t("isenable-otp-help.p4")}</p></div></Tooltip></label>@@ -942,8 +942,8 @@ const Forms = (props) => {type="radio"value={"true"}className="op-radio op-radio-xs"- name="IsDisableOTP"- checked={formData.IsDisableOTP === "true"}+ name="IsEnableOTP"+ checked={formData.IsEnableOTP === "true"}onChange={handleStrInput}/><div className="text-center">{t("yes")}</div>@@ -956,9 +956,9 @@ const Forms = (props) => {<inputtype="radio"value={"false"}- name="IsDisableOTP"+ name="IsEnableOTP"className="op-radio op-radio-xs"- checked={formData.IsDisableOTP === "false"}+ checked={formData.IsEnableOTP === "false"}onChange={handleStrInput}/><div className="text-center">{t("no")}</div>@@ -969,15 +969,16 @@ const Forms = (props) => {)}</div>)}- <div- onClick={() => setIsAdvanceOpt(!isAdvanceOpt)}- className={`mt-2.5 op-link op-link-primary text-sm`}- >- {isAdvanceOpt- ? t("hide-advanced-options")- : t("advanced-options")}- </div>-+ {props.title !== "Sign Yourself" && (+ <div+ onClick={() => setIsAdvanceOpt(!isAdvanceOpt)}+ className={`mt-2.5 op-link op-link-primary text-sm`}+ >+ {isAdvanceOpt+ ? t("hide-advanced-options")+ : t("advanced-options")}+ </div>+ )}<div className="flex items-center mt-3 gap-2"><buttonclassName={`${diff --git a/apps/OpenSign/src/pages/GuestLogin.js b/apps/OpenSign/src/pages/GuestLogin.jsindex 319200780..6a1b5877c 100644--- a/apps/OpenSign/src/pages/GuestLogin.js+++ b/apps/OpenSign/src/pages/GuestLogin.js@@ -194,11 +194,11 @@ function GuestLogin() {setLoading(true);const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);setContactId(linkContactRes.contactId);- const isDisableOTP = await navigateToDoc(+ const IsEnableOTP = await navigateToDoc(documentId,linkContactRes.contactId);- if (!isDisableOTP) {+ if (!IsEnableOTP) {setEnterOtp(true);await SendOtp();}diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.jsindex f94eacb6c..6b5cad2ae 100644--- a/apps/OpenSign/src/pages/PdfRequestFiles.js+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js@@ -579,8 +579,8 @@ function PdfRequestFiles(props) {) {setRequestSignTour(true);} else {- const isDisableOTP = documentData?.[0]?.IsDisableOTP || false;- if (isDisableOTP) {+ const isEnableOTP = documentData?.[0]?.IsEnableOTP || false;+ if (!isEnableOTP) {try {const resContact = await axios.post(`${localStorage.getItem("baseUrl")}functions/getcontact`,@@ -682,9 +682,9 @@ function PdfRequestFiles(props) {);let currentUser = JSON.parse(localuser);let isEmailVerified = currentUser?.emailVerified;- const isDisableOTP = pdfDetails?.[0]?.IsDisableOTP || false;+ const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;//if emailVerified data is not present in local user details then fetch again in _User class- if (!isDisableOTP) {+ if (isEnableOTP) {try {if (!currentUser?.emailVerified) {const userQuery = new Parse.Query(Parse.User);@@ -704,7 +704,7 @@ function PdfRequestFiles(props) {}}//check if isEmailVerified then go on next step- if (isDisableOTP || isEmailVerified) {+ if (!isEnableOTP || isEmailVerified) {try {const checkUser = signerPos.filter((data) => data.signerObjId === signerObjectId@@ -1318,8 +1318,8 @@ function PdfRequestFiles(props) {const closeRequestSignTour = async () => {setRequestSignTour(true);if (isDontShow) {- const isDisableOTP = pdfDetails?.[0]?.IsDisableOTP || false;- if (isDisableOTP) {+ const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;+ if (!isEnableOTP) {try {await axios.post(`${localStorage.getItem("baseUrl")}functions/updatecontacttour`,diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.jsindex 79d3530b7..ed5a69921 100644--- a/apps/OpenSign/src/primitives/GetReportDisplay.js+++ b/apps/OpenSign/src/primitives/GetReportDisplay.js@@ -267,7 +267,7 @@ const ReportTable = (props) => {SendinOrder: Doc?.SendinOrder || false,AutomaticReminders: Doc?.AutomaticReminders || false,RemindOnceInEvery: Doc?.RemindOnceInEvery || 5,- IsDisableOTP: Doc?.IsDisableOTP || false+ IsEnableOTP: Doc?.IsEnableOTP || false};try {const res = await axios.post(diff --git a/apps/OpenSign/src/script/locales/en/translation.json b/apps/OpenSign/src/script/locales/en/translation.jsonindex 87da2c203..f6f53ce31 100644--- a/apps/OpenSign/src/script/locales/en/translation.json+++ b/apps/OpenSign/src/script/locales/en/translation.json@@ -636,8 +636,8 @@"sent-this-month": "Sent this month","available-seats": "Available seats","buy-users": "Buy more users",- "isdisable-otp": "Enable OTP verification",- "isdisable-otp-help": {+ "isenable-otp": "Enable OTP verification",+ "isenable-otp-help": {"p1": "Would you like to enable the verification process using a one-time password (OTP)?","p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.","p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",diff --git a/apps/OpenSign/src/script/locales/fr/translation.json b/apps/OpenSign/src/script/locales/fr/translation.jsonindex ad5831e6c..3bacdcc59 100644--- a/apps/OpenSign/src/script/locales/fr/translation.json+++ b/apps/OpenSign/src/script/locales/fr/translation.json@@ -635,8 +635,8 @@"sent-this-month": "envoyé ce mois-ci","available-seats": "Disponible sièges","buy-users": "Acheter plus d'utilisateurs",- "isdisable-otp": "Activer la vérification OTP",- "isdisable-otp-help": {+ "isenable-otp": "Activer la vérification OTP",+ "isenable-otp-help": {"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?","p2": "La sélection de cette option activera la vérification OTP. Les utilisateurs recevront un code de vérification par e-mail, qu'ils devront saisir pour signer le document.","p3": "La sélection de cette option désactivera la vérification OTP, permettant aux utilisateurs de signer le document directement sans étapes supplémentaires.",diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.jsindex cf9792109..784cd32fe 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js@@ -196,8 +196,9 @@ export default async function createDocumentWithTemplate(request, response) {if (TimeToCompleteDays) {object.set('TimeToCompleteDays', TimeToCompleteDays);}- const isDisableOTP = template?.IsDisableOTP || request.body?.isDisableOTP || false;- object.set('IsDisableOTP', isDisableOTP);+ const enableOTP = request.body?.enableOTP === true ? true : false;+ const IsEnableOTP = template?.IsEnableOTP || enableOTP;+ object.set('IsEnableOTP', IsEnableOTP);object.set('CreatedBy', template.CreatedBy);object.set('ExtUserPtr', {__type: 'Pointer',diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.jsindex 2b77bd3fc..45e6eab4e 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js@@ -63,7 +63,7 @@ export default async function createDocumentwithCoordinate(request, response) {const email_body = request.body.email_body;const sendInOrder = request.body.sendInOrder || false;const TimeToCompleteDays = request.body.timeToCompleteDays || 15;- const isDisableOTP = request.body.isDisableOTP || false;+ const IsEnableOTP = request.body?.enableOTP === true ? true : false;// console.log('fileData ', fileData);const protocol = customAPIurl();const baseUrl = new URL(process.env.PUBLIC_URL);@@ -163,7 +163,7 @@ export default async function createDocumentwithCoordinate(request, response) {if (TimeToCompleteDays) {object.set('TimeToCompleteDays', TimeToCompleteDays);}- object.set('IsDisableOTP', isDisableOTP);+ object.set('IsEnableOTP', IsEnableOTP);object.set('IsSendMail', send_email);let contact = [];if (signers && signers.length > 0) {diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.jsindex 851d5a88c..ad9462ca3 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js@@ -9,6 +9,7 @@ export default async function createTemplate(request, response) {const SendinOrder = request.body.sendInOrder || false;const fileData = request.files?.[0] ? request.files[0].buffer : null;const baseUrl = new URL(process.env.PUBLIC_URL);+ const isEnableOTP = request.body?.enableOTP === true ? true : false;try {const reqToken = request.headers['x-api-token'];@@ -65,6 +66,7 @@ export default async function createTemplate(request, response) {object.set('URL', fileUrl);object.set('CreatedBy', userPtr);object.set('ExtUserPtr', extUserPtr);+ object.set('IsEnableOTP', isEnableOTP);if (SendinOrder) {object.set('SendinOrder', SendinOrder);}diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplatewithCoordinate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplatewithCoordinate.jsindex e3b01bf89..ebbbd0a60 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplatewithCoordinate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplatewithCoordinate.js@@ -17,7 +17,7 @@ export default async function createTemplatewithCoordinate(request, response) {const base64File = request.body.file;const fileData = request.files?.[0] ? request.files[0].buffer : null;const SendinOrder = request.body.sendInOrder || false;- const isDisableOTP = request.body.isDisableOTP || false;+ const isEnableOTP = request.body?.enableOTP === true ? true : false;// console.log('fileData ', fileData);const protocol = customAPIurl();@@ -82,7 +82,7 @@ export default async function createTemplatewithCoordinate(request, response) {object.set('URL', fileUrl);object.set('CreatedBy', userPtr);object.set('ExtUserPtr', extUserPtr);- object.set('IsDisableOTP', isDisableOTP);+ object.set('IsEnableOTP', isEnableOTP);let contact = [];if (signers && signers.length > 0) {let parseSigners;diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/draftDocument.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/draftDocument.jsindex 2bb36b518..2673d262c 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/draftDocument.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/draftDocument.js@@ -12,6 +12,8 @@ export default async function draftDocument(request, response) {const send_email = request.body.send_email || true;const fileData = request.files?.[0] ? request.files[0].buffer : null;const SendinOrder = request.body.sendInOrder || false;+ const isEnableOTP = request.body?.enableOTP === true ? true : false;+// console.log('fileData ', fileData);const protocol = customAPIurl();const baseUrl = new URL(process.env.PUBLIC_URL);@@ -83,6 +85,7 @@ export default async function draftDocument(request, response) {object.set('CreatedBy', userPtr);object.set('ExtUserPtr', extUserPtr);object.set('IsSendMail', send_email);+ object.set('IsEnableOTP', isEnableOTP);if (signers && signers.length > 0) {let parseSigners;if (base64File) {diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocument.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocument.jsindex d1a33bf2a..5f2150293 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocument.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocument.js@@ -62,6 +62,7 @@ export default async function getDocument(request, response) {document?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||[],sendInOrder: document?.SendinOrder || false,+ enableOTP: document?.IsEnableOTP || false,createdAt: document.createdAt,updatedAt: document.updatedAt,});diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocumentList.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocumentList.jsindex 6dcc119a2..a25e7bd2f 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocumentList.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/getDocumentList.js@@ -100,6 +100,7 @@ export default async function getDocumentList(request, response) {x?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||[],sendInOrder: x?.SendinOrder || false,+ enableOTP: x?.IsEnableOTP || false,createdAt: x.createdAt,updatedAt: x.updatedAt,}));diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplate.jsindex 7b3daa28d..43a0ec966 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplate.js@@ -61,6 +61,7 @@ export default async function getTemplate(request, response) {),})) || [],sendInOrder: template?.SendinOrder || false,+ enableOTP: template?.IsEnableOTP || false,createdAt: template.createdAt,updatedAt: template.updatedAt,});diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplateList.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplateList.jsindex 047db883d..dcf05ae60 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplateList.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplateList.js@@ -88,6 +88,7 @@ export default async function getTemplatetList(request, response) {),})) || [],sendInOrder: template?.SendinOrder || false,+ enableOTP: template?.IsEnableOTP || false,createdAt: template.createdAt,updatedAt: template.updatedAt,}));diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.jsindex 4e5246f0a..11365bc32 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.js@@ -48,6 +48,10 @@ export default async function updateDocument(request, response) {objectId: request?.body?.folderId,});}++ if (request.body?.enableOTP) {+ updateQuery.set('IsEnableOTP', request.body?.enableOTP);+ }const updatedRes = await updateQuery.save(null, { useMasterKey: true });if (updatedRes) {if (request.posthog) {diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.jsindex 466721610..c78711f7f 100644--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.js+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.js@@ -48,6 +48,9 @@ export default async function updateTemplate(request, response) {objectId: request?.body?.folderId,});}+ if (request.body?.enableOTP) {+ updateQuery.set('IsEnableOTP', request.body?.enableOTP);+ }const updatedRes = await updateQuery.save(null, { useMasterKey: true });if (updatedRes) {if (request.posthog) {diff --git a/apps/OpenSignServer/cloud/parsefunction/callWebhook.js b/apps/OpenSignServer/cloud/parsefunction/callWebhook.jsindex 1eb8ddda7..6d21b2ea3 100644--- a/apps/OpenSignServer/cloud/parsefunction/callWebhook.js+++ b/apps/OpenSignServer/cloud/parsefunction/callWebhook.js@@ -10,9 +10,9 @@ export default async function callWebhook(request) {try {const docQuery = new Parse.Query('contracts_Document');const docRes = await docQuery.get(docId, { useMasterKey: true });- const isDisableOTP = docRes?.get('IsDisableOTP') || false;+ const isEnableOTP = docRes?.get('IsEnableOTP') || false;let userId;- if (!isDisableOTP) {+ if (!isEnableOTP) {const userRes = await axios.get(serverUrl + '/users/me', {headers: {'X-Parse-Application-Id': appId,@@ -21,7 +21,7 @@ export default async function callWebhook(request) {});userId = userRes.data && userRes.data.objectId;}- if (isDisableOTP || userId) {+ if (!isEnableOTP || userId) {if (event === 'viewed' && contactId) {if (docRes) {const _docRes = docRes.toJSON();diff --git a/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js b/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.jsindex 847015156..b3afa2a02 100644--- a/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js+++ b/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js@@ -199,7 +199,7 @@ export default async function createBatchDocs(request) {TimeToCompleteDays: x.TimeToCompleteDays || 15,OriginIp: Ip,DocSentAt: { __type: 'Date', iso: isoDate },- IsDisableOTP: x?.IsDisableOTP || false,+ IsEnableOTP: x?.IsEnableOTP || false,},};});diff --git a/apps/OpenSignServer/cloud/parsefunction/getDocument.js b/apps/OpenSignServer/cloud/parsefunction/getDocument.jsindex 0d99e3c63..9478ab35d 100644--- a/apps/OpenSignServer/cloud/parsefunction/getDocument.js+++ b/apps/OpenSignServer/cloud/parsefunction/getDocument.js@@ -19,8 +19,8 @@ export default async function getDocument(request) {query.notEqualTo('IsArchive', true);const res = await query.first({ useMasterKey: true });if (res) {- const IsDisableOTP = res?.get('IsDisableOTP') || false;- if (IsDisableOTP) {+ const IsEnableOTP = res?.get('IsEnableOTP') || false;+ if (!IsEnableOTP) {return res;} else {if (request?.headers?.['sessiontoken']) {diff --git a/apps/OpenSignServer/cloud/parsefunction/getSignedUrl.js b/apps/OpenSignServer/cloud/parsefunction/getSignedUrl.jsindex f337c3355..7fc0ef507 100644--- a/apps/OpenSignServer/cloud/parsefunction/getSignedUrl.js+++ b/apps/OpenSignServer/cloud/parsefunction/getSignedUrl.js@@ -34,7 +34,7 @@ export async function getSignedUrl(request) {try {const query = new Parse.Query('contracts_Document');query.equalTo('objectId', docId);- query.equalTo('IsDisableOTP', true);+ query.notEqualTo('IsEnableOTP', true);query.include('CreatedBy');query.include('Signers');query.include('AuditTrail.UserPtr');diff --git a/apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.js b/apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.jsindex b437d8040..d9f33c1a7 100644--- a/apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.js+++ b/apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.js@@ -32,7 +32,7 @@ export default async function GenerateCertificate(docDetails) {const OriginIp = docDetails?.OriginIp || '';const company = docDetails?.ExtUserPtr?.Company || '';const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt;- const isDisableOTP = docDetails?.IsDisableOTP || false;+ const IsEnableOTP = docDetails?.IsEnableOTP || false;const auditTrail =docDetails?.Signers?.length > 0? docDetails.AuditTrail.map(x => {@@ -349,7 +349,7 @@ export default async function GenerateCertificate(docDetails) {font: timesRomanFont,color: textValueColor,});- if (!isDisableOTP) {+ if (IsEnableOTP) {page.drawText('Security level :', {x: half + 55,y: yPosition4 + 10,diff --git a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.jsindex 55f1707f7..d9fc2f94a 100644--- a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js+++ b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js@@ -286,9 +286,9 @@ async function PDF(req) {if (!resDoc) {throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found.');}- const IsDisableOTP = resDoc?.get('IsDisableOTP') || false;- // if `IsDisableOTP` is true then we don't have to check authentication- if (!IsDisableOTP) {+ const IsEnableOTP = resDoc?.get('IsEnableOTP') || false;+ // if `IsEnableOTP` is false then we don't have to check authentication+ if (IsEnableOTP) {if (!req?.user) {throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');}diff --git a/apps/OpenSignServer/databases/migrations/20240913121404-add_isdisableotp_doc.cjs b/apps/OpenSignServer/databases/migrations/20240913121404-add_isenableotp_doc.cjssimilarity index 77%rename from apps/OpenSignServer/databases/migrations/20240913121404-add_isdisableotp_doc.cjsrename to apps/OpenSignServer/databases/migrations/20240913121404-add_isenableotp_doc.cjsindex d8835fa8c..b87c1c1fe 100644--- a/apps/OpenSignServer/databases/migrations/20240913121404-add_isdisableotp_doc.cjs+++ b/apps/OpenSignServer/databases/migrations/20240913121404-add_isenableotp_doc.cjs@@ -4,12 +4,12 @@*/exports.up = async Parse => {const templateSchema = new Parse.Schema('contracts_Template');- templateSchema.addBoolean('IsDisableOTP');+ templateSchema.addBoolean('IsEnableOTP');await templateSchema.update();const className = 'contracts_Document';const schema = new Parse.Schema(className);- schema.addBoolean('IsDisableOTP');+ schema.addBoolean('IsEnableOTP');return schema.update();};@@ -19,11 +19,11 @@ exports.up = async Parse => {*/exports.down = async Parse => {const templateSchema = new Parse.Schema('contracts_Template');- templateSchema.deleteField('IsDisableOTP');+ templateSchema.deleteField('IsEnableOTP');await templateSchema.update();const className = 'contracts_Document';const schema = new Parse.Schema(className);- schema.deleteField('IsDisableOTP');+ schema.deleteField('IsEnableOTP');return schema.update();};