Skip to content

Commit 4caf9f5

Browse files
refactor: change variable from isDisableOTP to isEnableOTP
1 parent cc11848 commit 4caf9f5

28 files changed

+156
-73
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@
639639
"sent-this-month":"Sent this month",
640640
"available-seats":"Available seats",
641641
"buy-users":"Buy more users",
642-
"isdisable-otp": "Enable OTP verification",
643-
"isdisable-otp-help": {
642+
"isenable-otp": "Enable OTP verification",
643+
"isenable-otp-help": {
644644
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
645645
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
646646
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@
638638
"sent-this-month":"envoyé ce mois-ci",
639639
"available-seats":"Disponible sièges",
640640
"buy-users":"Acheter plus d'utilisateurs",
641-
"isdisable-otp": "Activer la vérification OTP",
642-
"isdisable-otp-help": {
641+
"isenable-otp": "Activer la vérification OTP",
642+
"isenable-otp-help": {
643643
"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?",
644644
"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.",
645645
"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.",

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

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { checkIsSubscribed, getFileName } from "../../constant/Utils";
33
import Upgrade from "../../primitives/Upgrade";
44
import { isEnableSubscription } from "../../constant/const";
55
import { useTranslation } from "react-i18next";
6+
import { Tooltip } from "react-tooltip";
7+
68
// import SelectFolder from "../../premitives/SelectFolder";
79

810
const EditTemplate = ({ template, onSuccess }) => {
@@ -14,7 +16,8 @@ const EditTemplate = ({ template, onSuccess }) => {
1416
Description: template?.Description || "",
1517
SendinOrder: template?.SendinOrder ? `${template?.SendinOrder}` : "false",
1618
AutomaticReminders: template?.AutomaticReminders || false,
17-
RemindOnceInEvery: template?.RemindOnceInEvery || 5
19+
RemindOnceInEvery: template?.RemindOnceInEvery || 5,
20+
IsEnableOTP: template?.IsEnableOTP ? `${template?.IsEnableOTP}` : "false"
1821
});
1922
const [isSubscribe, setIsSubscribe] = useState(false);
2023
useEffect(() => {
@@ -184,6 +187,70 @@ const EditTemplate = ({ template, onSuccess }) => {
184187
/>
185188
</div>
186189
)}
190+
{isEnableSubscription && (
191+
<div className="text-xs mt-2">
192+
<label className="block">
193+
<span className={isSubscribe ? "" : " text-gray-300"}>
194+
{t("isenable-otp")}{" "}
195+
<a data-tooltip-id="isenableotp-tooltip" className="ml-1">
196+
<sup>
197+
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
198+
</sup>
199+
</a>{" "}
200+
{!isSubscribe && isEnableSubscription && <Upgrade />}
201+
</span>
202+
<Tooltip id="isenableotp-tooltip" className="z-50">
203+
<div className="max-w-[200px] md:max-w-[450px]">
204+
<p className="font-bold">{t("isenable-otp")}</p>
205+
<p>{t("isenable-otp-help.p1")}</p>
206+
<p className="p-[5px]">
207+
<ol className="list-disc">
208+
<li>
209+
<span className="font-bold">{t("yes")}: </span>
210+
<span>{t("isenable-otp-help.p2")}</span>
211+
</li>
212+
<li>
213+
<span className="font-bold">{t("no")}: </span>
214+
<span>{t("isenable-otp-help.p3")}</span>
215+
</li>
216+
</ol>
217+
</p>
218+
<p>{t("isenable-otp-help.p4")}</p>
219+
</div>
220+
</Tooltip>
221+
</label>
222+
<div
223+
className={`${
224+
isSubscribe ? "" : "pointer-events-none opacity-50"
225+
} flex items-center gap-2 ml-2 mb-1 `}
226+
>
227+
<input
228+
type="radio"
229+
value={"true"}
230+
className="op-radio op-radio-xs"
231+
name="IsEnableOTP"
232+
checked={formData.IsEnableOTP === "true"}
233+
onChange={handleStrInput}
234+
/>
235+
<div className="text-center">{t("yes")}</div>
236+
</div>
237+
<div
238+
className={`${
239+
isSubscribe ? "" : "pointer-events-none opacity-50"
240+
} flex items-center gap-2 ml-2 mb-1 `}
241+
>
242+
<input
243+
type="radio"
244+
value={"false"}
245+
name="IsEnableOTP"
246+
className="op-radio op-radio-xs"
247+
checked={formData.IsEnableOTP === "false"}
248+
onChange={handleStrInput}
249+
/>
250+
<div className="text-center">{t("no")}</div>
251+
</div>
252+
</div>
253+
)}
187254
<div className="mt-[1rem] flex justify-start">
188255
<button type="submit" className="op-btn op-btn-primary">
189256
{t("submit")}

apps/OpenSign/src/constant/Utils.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,7 @@ export const handleDownloadPdf = async (
20452045
) => {
20462046
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
20472047
setIsDownloading("pdf");
2048-
const docId = pdfDetails?.[0]?.IsDisableOTP ? pdfDetails?.[0]?.objectId : "";
2048+
const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";
20492049
try {
20502050
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
20512051
const axiosRes = await axios.post(
@@ -2082,10 +2082,8 @@ export const handleToPrint = async (
20822082
) => {
20832083
event.preventDefault();
20842084
setIsDownloading("pdf");
2085+
const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";
20852086
try {
2086-
const docId = pdfDetails?.[0]?.IsDisableOTP
2087-
? pdfDetails?.[0]?.objectId
2088-
: "";
20892087
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
20902088
//`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign
20912089
//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

apps/OpenSign/src/pages/Form.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const Forms = (props) => {
6262
file: "",
6363
remindOnceInEvery: 5,
6464
autoreminder: false,
65-
IsDisableOTP: "false"
65+
IsEnableOTP: "false"
6666
});
6767
const [fileupload, setFileUpload] = useState("");
6868
const [fileload, setfileload] = useState(false);
@@ -404,11 +404,11 @@ const Forms = (props) => {
404404
object.set("AutomaticReminders", formData.autoreminder);
405405
object.set("RemindOnceInEvery", parseInt(formData.remindOnceInEvery));
406406
if (isEnableSubscription) {
407-
const IsDisableOTP =
408-
formData.IsDisableOTP === "false" ? true : false;
409-
object.set("IsDisableOTP", IsDisableOTP);
407+
const IsEnableOTP =
408+
formData?.IsEnableOTP === "false" ? false : true;
409+
object.set("IsEnableOTP", IsEnableOTP);
410410
} else {
411-
object.set("IsDisableOTP", true);
411+
object.set("IsEnableOTP", false);
412412
}
413413
}
414414
object.set("URL", fileupload);
@@ -446,7 +446,7 @@ const Forms = (props) => {
446446
file: "",
447447
remindOnceInEvery: 5,
448448
autoreminder: false,
449-
IsDisableOTP: "false"
449+
IsEnableOTP: "false"
450450
});
451451
setFileUpload("");
452452
setpercentage(0);
@@ -496,7 +496,7 @@ const Forms = (props) => {
496496
file: "",
497497
remindOnceInEvery: 5,
498498
autoreminder: false,
499-
IsDisableOTP: "false"
499+
IsEnableOTP: "false"
500500
});
501501
setFileUpload("");
502502
setpercentage(0);
@@ -896,9 +896,9 @@ const Forms = (props) => {
896896
<div className="text-xs mt-2">
897897
<label className="block">
898898
<span className={isSubscribe ? "" : " text-gray-300"}>
899-
{t("isdisable-otp")}{" "}
899+
{t("isenable-otp")}{" "}
900900
<a
901-
data-tooltip-id="isdisableotp-tooltip"
901+
data-tooltip-id="isenableotp-tooltip"
902902
className="ml-1"
903903
>
904904
<sup>
@@ -909,27 +909,27 @@ const Forms = (props) => {
909909
<Upgrade />
910910
)}
911911
</span>
912-
<Tooltip id="isdisableotp-tooltip" className="z-50">
912+
<Tooltip id="isenableotp-tooltip" className="z-50">
913913
<div className="max-w-[200px] md:max-w-[450px]">
914-
<p className="font-bold">{t("isdisable-otp")}</p>
915-
<p>{t("isdisable-otp-help.p1")}</p>
914+
<p className="font-bold">{t("isenable-otp")}</p>
915+
<p>{t("isenable-otp-help.p1")}</p>
916916
<p className="p-[5px]">
917917
<ol className="list-disc">
918918
<li>
919919
<span className="font-bold">
920920
{t("yes")}:{" "}
921921
</span>
922-
<span>{t("isdisable-otp-help.p2")}</span>
922+
<span>{t("isenable-otp-help.p2")}</span>
923923
</li>
924924
<li>
925925
<span className="font-bold">
926926
{t("no")}:{" "}
927927
</span>
928-
<span>{t("isdisable-otp-help.p3")}</span>
928+
<span>{t("isenable-otp-help.p3")}</span>
929929
</li>
930930
</ol>
931931
</p>
932-
<p>{t("isdisable-otp-help.p4")}</p>
932+
<p>{t("isenable-otp-help.p4")}</p>
933933
</div>
934934
</Tooltip>
935935
</label>
@@ -942,8 +942,8 @@ const Forms = (props) => {
942942
type="radio"
943943
value={"true"}
944944
className="op-radio op-radio-xs"
945-
name="IsDisableOTP"
946-
checked={formData.IsDisableOTP === "true"}
945+
name="IsEnableOTP"
946+
checked={formData.IsEnableOTP === "true"}
947947
onChange={handleStrInput}
948948
/>
949949
<div className="text-center">{t("yes")}</div>
@@ -956,9 +956,9 @@ const Forms = (props) => {
956956
<input
957957
type="radio"
958958
value={"false"}
959-
name="IsDisableOTP"
959+
name="IsEnableOTP"
960960
className="op-radio op-radio-xs"
961-
checked={formData.IsDisableOTP === "false"}
961+
checked={formData.IsEnableOTP === "false"}
962962
onChange={handleStrInput}
963963
/>
964964
<div className="text-center">{t("no")}</div>
@@ -969,15 +969,16 @@ const Forms = (props) => {
969969
)}
970970
</div>
971971
)}
972-
<div
973-
onClick={() => setIsAdvanceOpt(!isAdvanceOpt)}
974-
className={`mt-2.5 op-link op-link-primary text-sm`}
975-
>
976-
{isAdvanceOpt
977-
? t("hide-advanced-options")
978-
: t("advanced-options")}
979-
</div>
980-
972+
{props.title !== "Sign Yourself" && (
973+
<div
974+
onClick={() => setIsAdvanceOpt(!isAdvanceOpt)}
975+
className={`mt-2.5 op-link op-link-primary text-sm`}
976+
>
977+
{isAdvanceOpt
978+
? t("hide-advanced-options")
979+
: t("advanced-options")}
980+
</div>
981+
)}
981982
<div className="flex items-center mt-3 gap-2">
982983
<button
983984
className={`${

apps/OpenSign/src/pages/GuestLogin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ function GuestLogin() {
194194
setLoading(true);
195195
const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);
196196
setContactId(linkContactRes.contactId);
197-
const isDisableOTP = await navigateToDoc(
197+
const IsEnableOTP = await navigateToDoc(
198198
documentId,
199199
linkContactRes.contactId
200200
);
201-
if (!isDisableOTP) {
201+
if (!IsEnableOTP) {
202202
setEnterOtp(true);
203203
await SendOtp();
204204
}

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ function PdfRequestFiles(props) {
579579
) {
580580
setRequestSignTour(true);
581581
} else {
582-
const isDisableOTP = documentData?.[0]?.IsDisableOTP || false;
583-
if (isDisableOTP) {
582+
const isEnableOTP = documentData?.[0]?.IsEnableOTP || false;
583+
if (!isEnableOTP) {
584584
try {
585585
const resContact = await axios.post(
586586
`${localStorage.getItem("baseUrl")}functions/getcontact`,
@@ -682,9 +682,9 @@ function PdfRequestFiles(props) {
682682
);
683683
let currentUser = JSON.parse(localuser);
684684
let isEmailVerified = currentUser?.emailVerified;
685-
const isDisableOTP = pdfDetails?.[0]?.IsDisableOTP || false;
685+
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
686686
//if emailVerified data is not present in local user details then fetch again in _User class
687-
if (!isDisableOTP) {
687+
if (isEnableOTP) {
688688
try {
689689
if (!currentUser?.emailVerified) {
690690
const userQuery = new Parse.Query(Parse.User);
@@ -704,7 +704,7 @@ function PdfRequestFiles(props) {
704704
}
705705
}
706706
//check if isEmailVerified then go on next step
707-
if (isDisableOTP || isEmailVerified) {
707+
if (!isEnableOTP || isEmailVerified) {
708708
try {
709709
const checkUser = signerPos.filter(
710710
(data) => data.signerObjId === signerObjectId
@@ -1318,8 +1318,8 @@ function PdfRequestFiles(props) {
13181318
const closeRequestSignTour = async () => {
13191319
setRequestSignTour(true);
13201320
if (isDontShow) {
1321-
const isDisableOTP = pdfDetails?.[0]?.IsDisableOTP || false;
1322-
if (isDisableOTP) {
1321+
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
1322+
if (!isEnableOTP) {
13231323
try {
13241324
await axios.post(
13251325
`${localStorage.getItem("baseUrl")}functions/updatecontacttour`,

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ const ReportTable = (props) => {
267267
SendinOrder: Doc?.SendinOrder || false,
268268
AutomaticReminders: Doc?.AutomaticReminders || false,
269269
RemindOnceInEvery: Doc?.RemindOnceInEvery || 5,
270-
IsDisableOTP: Doc?.IsDisableOTP || false
270+
IsEnableOTP: Doc?.IsEnableOTP || false
271271
};
272272
try {
273273
const res = await axios.post(

apps/OpenSign/src/script/locales/en/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@
636636
"sent-this-month": "Sent this month",
637637
"available-seats": "Available seats",
638638
"buy-users": "Buy more users",
639-
"isdisable-otp": "Enable OTP verification",
640-
"isdisable-otp-help": {
639+
"isenable-otp": "Enable OTP verification",
640+
"isenable-otp-help": {
641641
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
642642
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
643643
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",

apps/OpenSign/src/script/locales/fr/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@
635635
"sent-this-month": "envoyé ce mois-ci",
636636
"available-seats": "Disponible sièges",
637637
"buy-users": "Acheter plus d'utilisateurs",
638-
"isdisable-otp": "Activer la vérification OTP",
639-
"isdisable-otp-help": {
638+
"isenable-otp": "Activer la vérification OTP",
639+
"isenable-otp-help": {
640640
"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?",
641641
"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.",
642642
"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.",

0 commit comments

Comments
 (0)