Skip to content

🔥 The free & Open Source DocuSign alternative

refactor: remove commented code and remove extra condition

RaktimaNXG65d5c7f33791
diff --git a/apps/OpenSign/src/pages/GuestLogin.js b/apps/OpenSign/src/pages/GuestLogin.js
index 409b29fb0..6df724448 100644
--- a/apps/OpenSign/src/pages/GuestLogin.js
+++ b/apps/OpenSign/src/pages/GuestLogin.js
@@ -9,9 +9,9 @@ import logo from "../assets/images/logo.png";
import { appInfo } from "../constant/appinfo";
function GuestLogin() {
- const { id, userMail, contactBookId, serverUrl, base64url } = useParams();
+ const { id, userMail, contactBookId, base64url } = useParams();
let navigate = useNavigate();
- const [email, setEmail] = useState("");
+ const [email, setEmail] = useState(userMail);
const [OTP, setOTP] = useState("");
const [EnterOTP, setEnterOtp] = useState(false);
const [loading, setLoading] = useState(false);
@@ -39,33 +39,23 @@ function GuestLogin() {
}
localStorage.clear();
- let parseId, appName, newServer;
- //first condition is used to manage previously stored URL data for the old route.
- if (id) {
- //split url in array from '&'
- const checkSplit = serverUrl.split("&");
- const server = checkSplit[0];
- parseId = checkSplit[1];
- appName = checkSplit[2];
- newServer = server.replaceAll("%2F", "/");
- setEmail(userMail);
- } else {
- //in this condition decode base64 route to in string and save required dataf.
- parseId = appInfo.appId;
- newServer = `${appInfo.baseUrl}/`;
- appName = appInfo.appname;
+ const parseId = appInfo.appId;
+ const newServer = `${appInfo.baseUrl}/`;
+ const appName = appInfo.appname;
+ localStorage.setItem("baseUrl", newServer);
+ localStorage.setItem("parseAppId", parseId);
+ localStorage.setItem("_appName", appName);
+ //first condition is used decode base64 to string and get userEmail,documentId, contactBoookId data.
+ if (!id) {
//`atob` function is used to decode base64
const decodebase64 = atob(base64url);
//split url in array from '/'
const checkSplit = decodebase64.split("/");
- setEmail(checkSplit[1]);
setDocumentId(checkSplit[0]);
+ setEmail(checkSplit[1]);
setContactId(checkSplit[2]);
}
- localStorage.setItem("baseUrl", newServer);
- localStorage.setItem("parseAppId", parseId);
- localStorage.setItem("_appName", appName);
setIsLoading(false);
};
diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js
index a1d768fad..57a6bef83 100644
--- a/apps/OpenSign/src/pages/PdfRequestFiles.js
+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js
@@ -740,19 +740,13 @@ function PdfRequestFiles() {
localStorage.getItem("parseAppId"),
sessionToken: localStorage.getItem("accesstoken")
};
- // const serverUrl = localStorage.getItem("baseUrl");
- // const newServer = serverUrl.replaceAll("/", "%2F");
const objectId = user.objectId;
- // const serverParams = `${newServer}&${localStorage.getItem(
- // "parseAppId"
- // )}&${localStorage.getItem("_appName")}`;
const hostUrl = window.location.origin;
//encode this url value `${pdfDetails?.[0].objectId}/${user.Email}/${objectId}` to base64 using `btoa` function
const encodeBase64 = btoa(
`${pdfDetails?.[0].objectId}/${user.Email}/${objectId}`
);
let signPdf = `${hostUrl}/login/${encodeBase64}`;
- // let signPdf = `${hostUrl}/login/${pdfDetails?.[0].objectId}/${user.Email}/${objectId}/${serverParams}`;
const openSignUrl =
"https://www.opensignlabs.com/contact-us";
const orgName = pdfDetails[0]?.ExtUserPtr.Company
diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js
index fe54580cd..927a0e14f 100644
--- a/apps/OpenSign/src/primitives/GetReportDisplay.js
+++ b/apps/OpenSign/src/primitives/GetReportDisplay.js
@@ -287,11 +287,6 @@ const ReportTable = (props) => {
const handleShare = (item) => {
setActLoader({ [item.objectId]: true });
const host = window.location.origin;
- // const serverUrl = process.env.REACT_APP_SERVERURL
- // ? process.env.REACT_APP_SERVERURL
- // : window.location.origin + "/api/app";
- // const baseURL = serverUrl.replace(/\//g, "%2F");
-
const getUrl = (x) => {
//encode this url value `${item.objectId}/${x.Email}/${x.objectId}` to base64 using `btoa` function
const encodeBase64 = btoa(`${item.objectId}/${x.Email}/${x.objectId}`);
diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js
index a075f3aae..f70466a9f 100644
--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js
+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js
@@ -218,7 +218,6 @@ export default async function createDocumentWithTemplate(request, response) {
const objectId = contactMail[i].contactPtr.objectId;
const hostUrl = baseUrl.origin;
- // let signPdf = `${hostUrl}/login/${res.id}/${contactMail[i].email}/${objectId}/${serverParams}`;
//encode this url value `${res.id}/${contactMail[i].email}/${objectId}` to base64 using `btoa` function
const encodeBase64 = btoa(`${res.id}/${contactMail[i].email}/${objectId}`);
let signPdf = `${hostUrl}/login/${encodeBase64}`;
diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js
index b954e046e..52c00ef33 100644
--- a/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js
+++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js
@@ -281,7 +281,6 @@ export default async function createDocumentwithCoordinate(request, response) {
//encode this url value `${response.id}/${contactMail[i].email}/${objectId}` to base64 using `btoa` function
const encodeBase64 = btoa(`${response.id}/${contactMail[i].email}/${objectId}`);
let signPdf = `${hostUrl}/login/${encodeBase64}`;
- // let signPdf = `${hostUrl}/login/${res.id}/${contactMail[i].email}/${objectId}/${serverParams}`;
const openSignUrl = 'https://www.opensignlabs.com/contact-us';
const orgName = parseExtUser.Company ? parseExtUser.Company : '';
const themeBGcolor = '#47a3ad';