Skip to content

Commit cc11848

Browse files
feat: add disable OTP feature to directly sign document without verification
1 parent c8ecd34 commit cc11848

26 files changed

+1039
-687
lines changed

apps/OpenSign/public/locales/en/translation.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,14 @@
638638
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
639639
"sent-this-month":"Sent this month",
640640
"available-seats":"Available seats",
641-
"buy-users":"Buy more users"
642-
641+
"buy-users":"Buy more users",
642+
"isdisable-otp": "Enable OTP verification",
643+
"isdisable-otp-help": {
644+
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
645+
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
646+
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",
647+
"p4": "Please choose the option that best suits your document signing requirements."
648+
},
649+
"advanced-options":"Advanced options",
650+
"hide-advanced-options":"Hide Advanced options"
643651
}

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,5 +637,15 @@
637637
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminEmail}}.",
638638
"sent-this-month":"envoyé ce mois-ci",
639639
"available-seats":"Disponible sièges",
640-
"buy-users":"Acheter plus d'utilisateurs"
640+
"buy-users":"Acheter plus d'utilisateurs",
641+
"isdisable-otp": "Activer la vérification OTP",
642+
"isdisable-otp-help": {
643+
"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?",
644+
"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.",
645+
"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.",
646+
"p4": "Veuillez choisir l'option qui correspond le mieux à vos exigences en matière de signature de documents."
647+
},
648+
"advanced-options":"Options avancées",
649+
"hide-advanced-options": "Masquer les options avancées"
650+
641651
}

apps/OpenSign/src/components/pdf/EmailComponent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ function EmailComponent({
154154
<div className="flex flex-row">
155155
{!isAndroid && (
156156
<button
157-
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
157+
onClick={(e) =>
158+
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
159+
}
158160
className="op-btn op-btn-neutral op-btn-sm text-[15px]"
159161
>
160162
<i className="fa-light fa-print" aria-hidden="true"></i>

apps/OpenSign/src/components/pdf/PdfHeader.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function Header({
142142
<DropdownMenu.Item
143143
className="DropdownMenuItem"
144144
onClick={(e) =>
145-
handleToPrint(e, pdfUrl, setIsDownloading)
145+
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
146146
}
147147
>
148148
<div className="flex flex-row">
@@ -342,7 +342,9 @@ function Header({
342342
alreadySign ? (
343343
<div className="flex flex-row">
344344
<button
345-
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
345+
onClick={(e) =>
346+
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
347+
}
346348
type="button"
347349
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
348350
>
@@ -459,7 +461,9 @@ function Header({
459461
</button>
460462
)}
461463
<button
462-
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
464+
onClick={(e) =>
465+
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
466+
}
463467
type="button"
464468
className="op-btn op-btn-neutral op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
465469
>

apps/OpenSign/src/constant/Utils.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,9 +1741,7 @@ export const contactBook = async (objectId) => {
17411741

17421742
//function for getting document details from contract_Documents class
17431743
export const contractDocument = async (documentId) => {
1744-
const data = {
1745-
docId: documentId
1746-
};
1744+
const data = { docId: documentId };
17471745
const documentDeatils = await axios
17481746
.post(`${localStorage.getItem("baseUrl")}functions/getDocument`, data, {
17491747
headers: {
@@ -2047,11 +2045,12 @@ export const handleDownloadPdf = async (
20472045
) => {
20482046
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
20492047
setIsDownloading("pdf");
2048+
const docId = pdfDetails?.[0]?.IsDisableOTP ? pdfDetails?.[0]?.objectId : "";
20502049
try {
20512050
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
20522051
const axiosRes = await axios.post(
20532052
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
2054-
{ url: pdfUrl },
2053+
{ url: pdfUrl, docId: docId },
20552054
{
20562055
headers: {
20572056
"content-type": "Application/json",
@@ -2075,16 +2074,24 @@ export const sanitizeFileName = (pdfName) => {
20752074
return pdfName.replace(/ /g, "_");
20762075
};
20772076
//function for print digital sign pdf
2078-
export const handleToPrint = async (event, pdfUrl, setIsDownloading) => {
2077+
export const handleToPrint = async (
2078+
event,
2079+
pdfUrl,
2080+
setIsDownloading,
2081+
pdfDetails
2082+
) => {
20792083
event.preventDefault();
20802084
setIsDownloading("pdf");
20812085
try {
2086+
const docId = pdfDetails?.[0]?.IsDisableOTP
2087+
? pdfDetails?.[0]?.objectId
2088+
: "";
20822089
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
20832090
//`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign
20842091
//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 url
20852092
const axiosRes = await axios.post(
20862093
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
2087-
{ url: pdfUrl },
2094+
{ url: pdfUrl, docId: docId },
20882095
{
20892096
headers: {
20902097
"content-type": "Application/json",

0 commit comments

Comments
 (0)