Compare commits

...
34 Commits
Author SHA1 Message Date
AmolandGitHub b4315b5e0a Merge pull request #163 from OpenSignLabs/staging
v1.0.4
2023-11-10 02:52:04 +05:30
AmolandGitHub c326849b8d Merge pull request #162 from rishabjasrotia/issue/146 2023-11-09 21:18:53 +05:30
prafull-opensignlabsandGitHub a92188d8e2 change variable name 2023-11-09 21:18:36 +05:30
prafull-opensignlabsandGitHub 4055574785 sanitize File Name in upload file 2023-11-09 20:48:53 +05:30
AmolandGitHub 9b295f784a Merge pull request #158 from raktima-opensignlabs/placeholder-mobile-view2 2023-11-09 20:37:49 +05:30
prafull-opensignlabsandGitHub bfae7f236c Merge branch 'staging' into placeholder-mobile-view2 2023-11-09 20:36:33 +05:30
AmolandGitHub fe907116e2 Merge pull request #156 from raktima-opensignlabs/login-header3 2023-11-09 20:27:04 +05:30
rishabjasrotia ade39c2f46 Doc Updated 2023-11-09 18:36:18 +05:30
AndrewandGitHub 31baefcce3 Merge pull request #161 from rishabjasrotia/issue/32 2023-11-09 18:32:23 +05:30
RishabandGitHub 59eb4eb9c7 #32 - Change the title of popup that appears after sending out emails from "Request signatures" flow
#32 - Change the title of popup that appears after sending out emails from "Request signatures" flow
2023-11-09 18:30:37 +05:30
rishabjasrotia 3b93f96479 Fix makefile 2023-11-09 18:05:34 +05:30
rishabjasrotia dbff436bc2 #146 - Fix issue of build & Add local File upload support 2023-11-09 17:53:34 +05:30
AmolandGitHub c3cf9c891e Merge pull request #160 from maoo/patch-1 2023-11-09 17:47:54 +05:30
Maurizio PillituandGitHub 4e7c8c63bb CORS configuration instructions
See https://github.com/OpenSignLabs/OpenSign/issues/159
2023-11-09 12:57:58 +01:00
RaktimaNXG 450a971ca9 remove isSigner exist checking from local storage 2023-11-09 14:30:17 +05:30
RaktimaNXG 5ba1f79f3b replce isSigner variable name to isGuestSigner 2023-11-09 14:23:56 +05:30
AndrewandGitHub d255d5bfb2 Merge pull request #151 from prafull-opensignlabs/mf_header 2023-11-09 12:01:41 +05:30
AndrewandGitHub f5e835cbc4 Merge pull request #148 from prafull-opensignlabs/fix_signup 2023-11-09 12:01:20 +05:30
AmolandGitHub b40eb7119d Merge branch 'issue/119' into staging 2023-11-08 22:36:01 +05:30
RaktimaNXG f56faf3afd handle placeholder block position and size on mobile view 2023-11-08 21:01:09 +05:30
RaktimaNXG 5fa60d8135 solved overflow header on logiin page 2023-11-08 20:42:35 +05:30
AmolandGitHub 695345d911 Merge pull request #144 from raktima-opensignlabs/main
fix: blocking popup on view expired and declined document screens
2023-11-08 20:11:16 +05:30
prafull-opensignlabs 3f60509254 remove header from report microapp 2023-11-08 16:55:30 +05:30
RaktimaandGitHub 6bd9ac0b8f Merge pull request #12 from OpenSignLabs/staging
Update
2023-11-08 16:55:09 +05:30
AmolandGitHub ccecec5e59 Merge pull request #149 from OpenSignLabs/staging
v1.0.3
2023-11-08 14:28:32 +05:30
prafull-opensignlabs 2022df000e fix: user sign up issue for user existing in contact list 2023-11-08 13:56:28 +05:30
prafull-opensignlabsandGitHub ec6e037422 Merge pull request #10 from OpenSignLabs/staging
sync fork
2023-11-07 18:35:15 +05:30
prafull-opensignlabsandGitHub 4b11fe77e0 Merge pull request #9 from OpenSignLabs/staging
sync fork
2023-11-07 17:40:34 +05:30
RaktimaNXG d42e11c5c1 fix: blocking screen by warning for expired and decline document 2023-11-07 11:32:25 +05:30
RaktimaNXG fe37f3e021 fix: expired and decline document block whole screeen 2023-11-06 14:51:33 +05:30
RaktimaandGitHub 95558d1407 Merge pull request #11 from OpenSignLabs/staging
update
2023-11-06 14:48:05 +05:30
rishabjasrotia 73978ebce4 Fix issue 2023-11-05 19:20:34 +05:30
rishabjasrotia 96ae95a97c Fix the generation of remoteentry.js for docker development 2023-11-05 19:13:54 +05:30
rishabjasrotia 356d2e81c5 Update Document & Self Signed Cert added 2023-11-05 19:09:15 +05:30
28 changed files with 1836 additions and 1318 deletions
+57 -3
View File
@@ -42,7 +42,7 @@ DO_SECRET_ACCESS_KEY=
# Digital ocean spaces region or AWS s3 region # Digital ocean spaces region or AWS s3 region
DO_REGION=us-west DO_REGION=us-west
# local storage # local storage
USE_LOCAL=TRUE USE_LOCAL=FALSE
# Email mailgun config (The app will not initialize if any of these 3 variables are not set) ********************************************************************************************************************* # Email mailgun config (The app will not initialize if any of these 3 variables are not set) *********************************************************************************************************************
MAILGUN_API_KEY=XXXXX MAILGUN_API_KEY=XXXXX
@@ -50,7 +50,61 @@ MAILGUN_DOMAIN=mail.yourdomain.com
MAILGUN_SENDER=postmaster@mail.yourdomain.com MAILGUN_SENDER=postmaster@mail.yourdomain.com
# Base64 encoded PFX or p12 document signing certificate file ********************************************************************************************************************* # Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************
PFX_BASE64= PFX_BASE64='MIIKLwIBAzCCCeUGCSqGSIb3DQEHAaCCCdYEggnSMIIJzjCCBEIGCSqGSIb3DQEH
BqCCBDMwggQvAgEAMIIEKAYJKoZIhvcNAQcBMFcGCSqGSIb3DQEFDTBKMCkGCSqG
SIb3DQEFDDAcBAh6cQqVpHfTzAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQME
ASoEEFKEIGJTTRo3voO/FvsXs7yAggPAI7rMCboTFFBfdMuuV3Y9/xfphAgdGD7P
0xAN10CcmXlMtedc8cRxOaD9n3Q7zJx5iIbqEGDTc0dgp5EtdWsGl7MP76iHkSfB
ZUPc13nbnRU4Nq4hNFcSj1m6NVa0lT9UobbTsG+wUkJn8aLfijzZ1OY82KLlKUoJ
lqLsQ1yZkeLiLKI0aEew/2vzfiLUX9A99qnCRoryo8ZbLiWl0Vu/FEKM5mqIRFEp
BKeSUsRxBfJCMZ2Ks5t4/MTCV+yrcsuhLPF/AJpzKfIinEFDhm7MxP4RXtk2LWNe
+EO2GuFRjZCfsMO0oNWybFmDeNDMCHZj5TeoqL1JwAV5e1lEeqR38v4Wcr4OVefY
DfdrJ2xdvm7XbBZ8Lgx8L4fwugw7oDyTpR2jJqHMlpOsQrxipN6UKkN6EVYeCC5K
4dF5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noZydrzBBJN1po9dkxb8LKuKZDEcnKo+tQrTnZJaFRXK
pQDsAjQ0HcYi8ZqN/GPezXOqzRgvObevXeDYTJrNejr46B1HqjPw8doai+AEf//1
iiM9EK4y3bGbX837oebTByRi112AOctISHTWbF0zdFMiBO9X9PML4n3i14ToqLH1
EUp0WtCdKLJmrRnO9PKJUMpce3yNu6oRSBzB4EkgUMOTVx9tM66h/gcR3wr+qKJP
1EABMbbCsJeYYLujhQHVh0JluqLBXYuCmr5n6o8qmonj5tEfTn9zs2gi0OvKTliH
wRXWsar004alt8D8o4M/Oqu3qyVV1O8BlVEofUC1CfAMIh/T1NJBeKG/FPfAFoEz
9liLLkoDvGvFVJ4Ezy4BaPtg+G3yU/SeiruwsCB3unHRD7G6VvS4jY2B8vEYl0yM
Z1mLFbKK8CIEvg8+v/vbc0noYUOzd6bkwh6Y6cziR/u78y2nALYZpQK+3XiVVH/v
SaVoDckZgUwAX+dMd1P4U3a487MPXBZZmLVFMHTuv3NvW6NIQCMd4l35ViRd7YcS
V2QDKTnUtPN2MSUwIwYJKoZIhvcNAQkVMRYEFMSz7PlBO5VzTDqC/foidPWrMjkw
MEEwMTANBglghkgBZQMEAgEFAAQgPlLuG+67SxPOEPbgFuEnVgewvY6LUzFmrprx
c6yryFgECIld0S5kDk7JAgIIAA=='
# Provide Pass pharse of above PFX or p12 document # Provide Pass pharse of above PFX or p12 document
PASS_PHRASE= PASS_PHRASE=
+3
View File
@@ -22,3 +22,6 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
apps/OpenSign/public/mfbuild/*
microfrontends/SignDocuments/build/*
apps/OpenSignServer/files/files/*
+60 -2
View File
@@ -88,5 +88,63 @@ You can install all 3 components on digital ocean using the button below -
## Localhost(Docker) ## Localhost(Docker)
Below are the steps to follow - For local Setup we need to need following prerequisite:
- Execute `make build`
Environment Varaibles:
| Environment Varibale | Value | Description |
| ------------- | ------------- | ------------- |
| CI | false | Set CI to false while running the app locally |
| PUBLIC_URL | http://localhost:3000 | Set it to the URL form where the app home page will be accessed |
| GENERATE_SOURCEMAP | false | Set it to true if you want to generate the Sourcemap for debugging |
| REACT_APP_SERVERURL | http://localhost:8080/app | Set it to the URL from where APIs will be accessible, for local development it should be localhost:3000/api/app (use your local port number instead) |
| REACT_APP_APPID | http://localhost:3000 | Set it to the URL form where the app home page will be accessed |
| PUBLIC_URL | opensignstgn | A 12 character long random app identifier. The value of this should be same as APP_ID which is a variable used by backend API. |
| APP_ID | opensignstgn | A 12 character long random app identifier. The value of this should be same as REACT_APP_APPID which is a variable used by Frontend React App. |
| appName | open_sign_server | Name of the app. It will be visible in the verification emails sent out. |
| MASTER_KEY | XnAadwKxxByMr | A 12 character long random secret key that allows access to all the data. It is used in Parse dashboard config to view all the data in the database. |
| MONGODB_URI | mongodb://host.docker.internal:27017/OpenSignDB | Mongodb URI to connect to |
| PARSE_MOUNT |/app | Path on which APIs should be mounted. Do not change this. This variable shall be removed & value hardcoded in the source code in coming versions. |
| SERVER_URL | http://127.0.0.1:8080/app | Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:3000/api/app (use your local port number instead) |
| DO_SPACE | DOSPACENAME | Digital ocean space name or AWS S3 bucket name for uploading documents |
| DO_ENDPOINT | ams3.digitaloceanspaces.com | Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents |
| DO_BASEURL |https://DOSPACENAME.ams3.digitaloceanspaces.com | Digital ocean baseurl or AWS S3 base URL |
| DO_ACCESS_KEY_ID | YOUR_S3_ACCESS_ID | Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs |
| DO_SECRET_ACCESS_KEY | YOUR_S3_ACCESS_KEY | Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs |
| DO_REGION | YOUR_S3_REGION | Digital ocean spaces region or AWS s3 region |
| USE_LOCAL | FALSE | To use local file storage to save file |
| MAILGUN_API_KEY | YOUR_MAILGUNAPI_KEY | Mailgun API Key |
| MAILGUN_DOMAIN | YOUR_MAILGUNAPI_DOMAIN | Mailgun API Domain |
| MAILGUN_SENDER | - | Mailgun Sender Mail ID |
| PFX_BASE64 | - | Base64 encoded PFX or p12 document signing certificate file. You can generate base64 encoded self sign certificate using the passphrase `emudhra` |
# Steps to Generate Self Sign Certificate
```
# execute below command and use passphrase emudhra
openssl genrsa -des3 -out ./cert/local_dev.key 2048
openssl req -key ./cert/local_dev.key -new -x509 -days 365 -out ./cert/local_dev.crt
openssl pkcs12 -inkey ./cert/local_dev.key -in ./cert/local_dev.crt -export -out ./cert/local_dev.pfx
openssl base64 -in ./cert/local_dev.pfx -out ./cert/base64_pfx
```
# CORS Configuration
As document storage is delegated to S3-compatible services that reside in a different host than the OpenSign one, document operations (loading, storing, deleting) are subject to [Cross-Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) restriction policies; as a consequence, OpenSign app may fail with (browser console) errors like the following:
```
Access to fetch at 'https://foo.nyc3.digitaloceanspaces.com/exported_file_4627_0000-00-00T00%3A45%3A43.344Z.pdf'
from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header
is present on the requested resource. If an opaque response serves your needs, set the request's mode to
'no-cors' to fetch the resource with CORS disabled.
```
In order to address this, your document storage system must be instructed to accept requests from other hosts; below the relevant documentation links:
- [How to Configure CORS on DigitalOcean Spaces](https://docs.digitalocean.com/products/spaces/how-to/configure-cors/)
- [Configuring cross-origin resource sharing on AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html)
# Build Local Environment
Command to build project -
- Execute `make build`
Command to run project -
- Execute `make run`
+6
View File
@@ -1,3 +1,9 @@
build: build:
cp .env.local_dev .env
rm -rf apps/OpenSign/public/mfbuild
cd microfrontends/SignDocuments && npm install && npm run build
docker compose up -d
run:
cp .env.local_dev .env cp .env.local_dev .env
docker compose up -d docker compose up -d
+1 -1
View File
@@ -21,5 +21,5 @@ EXPOSE 3000
# ENV NODE_ENV production # ENV NODE_ENV production
# Run the application # Run the application
CMD ["npm", "start"] ENTRYPOINT npm run start-dev
+29 -3
View File
@@ -141,6 +141,32 @@ const GoogleSignInBtn = ({
alert("Please fill required details!"); alert("Please fill required details!");
} }
}; };
const handleCloseModal = () => {
setIsModal(false);
Parse.User.logOut();
let appdata = localStorage.getItem("userSettings");
let applogo = localStorage.getItem("appLogo");
let appName = localStorage.getItem("appName");
let defaultmenuid = localStorage.getItem("defaultmenuid");
let PageLanding = localStorage.getItem("PageLanding");
let domain = localStorage.getItem("domain");
let _appName = localStorage.getItem("_appName");
let baseUrl = localStorage.getItem("BaseUrl12");
let appid = localStorage.getItem("AppID12");
localStorage.clear();
localStorage.setItem("appLogo", applogo);
localStorage.setItem("appName", appName);
localStorage.setItem("_appName", _appName);
localStorage.setItem("defaultmenuid", defaultmenuid);
localStorage.setItem("PageLanding", PageLanding);
localStorage.setItem("domain", domain);
localStorage.setItem("userSettings", appdata);
localStorage.setItem("BaseUrl12", baseUrl);
localStorage.setItem("AppID12", appid);
};
return ( return (
<div style={{ position: "relative" }}> <div style={{ position: "relative" }}>
{thirdpartyLoader && ( {thirdpartyLoader && (
@@ -259,16 +285,16 @@ const GoogleSignInBtn = ({
<div> <div>
<button <button
type="button" type="button"
className="btn btn-secondary" className="bg-[#6c757d] p-2 text-white rounded"
onClick={() => setIsModal(false)} onClick={handleCloseModal}
style={{ marginRight: 10, width: 90 }} style={{ marginRight: 10, width: 90 }}
> >
Cancel Cancel
</button> </button>
<button <button
type="button" type="button"
className="bg-[#17a2b8] p-2 text-white rounded"
onClick={() => handleSubmitbtn()} onClick={() => handleSubmitbtn()}
className="btn btn-info"
> >
Sign up Sign up
</button> </button>
+26 -50
View File
@@ -1,6 +1,6 @@
import useFederatedComponent from "mf-cra"; import useFederatedComponent from "mf-cra";
import React, { Suspense, useEffect } from "react"; import React, { Suspense, useEffect } from "react";
import { useNavigate, useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
const MicroappModal = () => { const MicroappModal = () => {
const { remoteApp } = useParams(); const { remoteApp } = useParams();
@@ -28,60 +28,36 @@ const MicroappModal = () => {
} }
// console.log("app ", remoteApp); // console.log("app ", remoteApp);
const { Component: RemoteComponent } = useFederatedComponent(obj); const { Component: RemoteComponent } = useFederatedComponent(obj);
const navigate = useNavigate();
// console.log("RemoteComponent ", RemoteComponent); // console.log("RemoteComponent ", RemoteComponent);
return ( return (
<div className="w-full h-full flex items-center justify-center "> <div className="w-full h-full flex items-center justify-center ">
{/* <!-- Modal Container --> */} <div className="w-full">
<div className="bg-white rounded-lg shadow-lg w-full"> <Suspense
{/* <!-- Modal Header --> */} fallback={
<div className="flex w-full items-center border-b-2 mb-2 p-2"> <div style={{ height: "300px" }}>
<button <div
className="focus:outline-none bg-blue-500 text-white text-sm shadow px-2.5 py-1 rounded" style={{
id="closeModal" marginLeft: "45%",
onClick={(e) => { marginTop: "150px",
e.preventDefault(); fontSize: "45px",
// setIsModal(false); color: "#3dd3e0"
navigate(-1); }}
className="loader-37"
></div>
</div>
}
>
<div
style={{
backgroundColor: "#ffffff",
width: "100%",
overflow: "hidden",
minHeight: "50vh"
}} }}
> >
Back {RemoteComponent && <RemoteComponent />}
</button> </div>
{localStorage.getItem("domain") && ( </Suspense>
<p className="flex-1 w-full text-sm md:text-base text-black text-center">
{localStorage.getItem("domain") === "contracts" ? "Document" : ""}
</p>
)}
</div>
{/* <!-- Modal Body --> */}
<div className="w-full">
<Suspense
fallback={
<div style={{ height: "300px" }}>
<div
style={{
marginLeft: "45%",
marginTop: "150px",
fontSize: "45px",
color: "#3dd3e0"
}}
className="loader-37"
></div>
</div>
}
>
<div
style={{
backgroundColor: "#ffffff",
width: "100%",
overflow: "hidden",
minHeight: "50vh"
}}
>
{RemoteComponent && <RemoteComponent />}
</div>
</Suspense>
</div>
</div> </div>
</div> </div>
); );
+420 -299
View File
@@ -21,17 +21,18 @@ function Login(props) {
passwordVisible: false, passwordVisible: false,
mobile: "", mobile: "",
phone: "", phone: "",
OTP: "",
hideNav: "", hideNav: "",
scanResult: "", scanResult: "",
baseUrl: localStorage.getItem("baseUrl"), baseUrl: localStorage.getItem("baseUrl"),
parseAppId: localStorage.getItem("parseAppId"), parseAppId: localStorage.getItem("parseAppId"),
loading: false, loading: false,
thirdpartyLoader: false, thirdpartyLoader: false
orgModal: false,
ReqOtp: ""
}); });
const [userDetails, setUserDetails] = useState({
Company: "",
Destination: ""
});
const [isModal, setIsModal] = useState(false);
const image = props?.appInfo?.applogo || undefined; const image = props?.appInfo?.applogo || undefined;
useEffect(() => { useEffect(() => {
@@ -94,7 +95,6 @@ function Login(props) {
} else { } else {
localStorage.setItem("profileImg", ""); localStorage.setItem("profileImg", "");
} }
// Check extended class user role and tenentId // Check extended class user role and tenentId
try { try {
let userRoles = []; let userRoles = [];
@@ -114,44 +114,36 @@ function Login(props) {
}; };
await axios await axios
.post(url, JSON.stringify(body), { headers: headers }) .post(url, JSON.stringify(body), { headers: headers })
.then((roles) => { .then((axiosRes) => {
const roles = axiosRes.data.result;
if (roles) { if (roles) {
userRoles = roles.data.result; userRoles = roles;
let _currentRole = ""; let _currentRole = "";
const valuesToExclude = [
"contracts_Guest",
`${localStorage.getItem("_appName")}_appeditor`
];
if (userRoles.length > 1) { if (userRoles.length > 1) {
if ( const rolesfiltered = userRoles.filter(
userRoles[0] === (x) => !valuesToExclude.includes(x)
`${localStorage.getItem("_appName")}_appeditor` );
) { if (rolesfiltered.length > 0) {
_currentRole = userRoles[1]; _currentRole = rolesfiltered[0];
} else { }
const rolesfiltered = userRoles.filter(
(x) => x !== "contracts_Guest"
);
if (rolesfiltered.length > 0) {
_currentRole = rolesfiltered[0];
} else {
setThirdpartyLoader(false);
setState({
...state,
loading: false,
toastColor: "#d9534f",
toastDescription: `Does not have permissions to access this application.`
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
}
// _currentRole = userRoles[0];
}
} else { } else {
_currentRole = userRoles[0]; const rolesfiltered = userRoles.filter(
(x) => !valuesToExclude.includes(x)
);
if (rolesfiltered.length > 0) {
_currentRole = userRoles[0];
} else {
_currentRole = "";
}
} }
if ( if (
_currentRole &&
_currentRole !== _currentRole !==
`${localStorage.getItem("_appName")}_appeditor` `${localStorage.getItem("_appName")}_appeditor`
) { ) {
userSettings.forEach(async (element) => { userSettings.forEach(async (element) => {
if (element.role === _currentRole) { if (element.role === _currentRole) {
@@ -178,7 +170,6 @@ function Login(props) {
query.include("TenantId"); query.include("TenantId");
await query.find().then( await query.find().then(
(results) => { (results) => {
// console.log("results ", results);
let tenentInfo = []; let tenentInfo = [];
if (results) { if (results) {
let extendedInfo_stringify = let extendedInfo_stringify =
@@ -339,25 +330,27 @@ function Login(props) {
} }
}, },
(error) => { (error) => {
/* alert( const payload = {
"You dont have access to this application." sessionToken: user.getSessionToken()
); */ };
setState({ handleSubmitbtn(payload);
...state, // setState({
loading: false, // ...state,
toastColor: "#d9534f", // loading: false,
toastDescription: // toastColor: "#d9534f",
"You dont have access to this application." // toastDescription:
}); // "You dont have access to this application."
const x = document.getElementById("snackbar"); // });
x.className = "show";
setTimeout(function () { // const x = document.getElementById("snackbar");
x.className = x.className.replace( // x.className = "show";
"show", // setTimeout(function () {
"" // x.className = x.className.replace(
); // "show",
}, 2000); // ""
localStorage.setItem("accesstoken", null); // );
// }, 2000);
// localStorage.setItem("accesstoken", null);
console.error( console.error(
"Error while fetching Follow", "Error while fetching Follow",
error error
@@ -367,45 +360,18 @@ function Login(props) {
} }
}); });
} else { } else {
setState({ setState({ ...state, loading: false });
...state, setIsModal(true);
loading: false,
toastColor: "#d9534f",
toastDescription: "User Role Not Found."
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
} }
} else { } else {
setState({ setState({ ...state, loading: false });
...state, setIsModal(true);
loading: false,
toastColor: "#d9534f",
toastDescription: "User Role Not Found."
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
} }
}) })
.catch((err) => { .catch((err) => {
console.log("err", err); console.log("err", err);
setState({ setState({ ...state, loading: false });
...state, setIsModal(true);
loading: false,
toastColor: "#d9534f",
toastDescription: `Does not have permissions to access this application.`
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
}); });
} }
} catch (error) { } catch (error) {
@@ -460,7 +426,6 @@ function Login(props) {
await Parse.User.become(sessionToken).then(() => { await Parse.User.become(sessionToken).then(() => {
window.localStorage.setItem("accesstoken", sessionToken); window.localStorage.setItem("accesstoken", sessionToken);
}); });
// console.log("me res ", res);
if (res.data) { if (res.data) {
let _user = res.data; let _user = res.data;
localStorage.setItem("UserInformation", JSON.stringify(_user)); localStorage.setItem("UserInformation", JSON.stringify(_user));
@@ -492,25 +457,36 @@ function Login(props) {
}; };
await axios await axios
.post(url, JSON.stringify(body), { headers: headers }) .post(url, JSON.stringify(body), { headers: headers })
.then((roles) => { .then((axiosRes) => {
const roles = axiosRes.data.result;
if (roles) { if (roles) {
userRoles = roles.data.result; userRoles = roles;
let _currentRole = ""; let _currentRole = "";
const valuesToExclude = [
"contracts_Guest",
`${localStorage.getItem("_appName")}_appeditor`
];
if (userRoles.length > 1) { if (userRoles.length > 1) {
if ( const rolesfiltered = userRoles.filter(
userRoles[0] === (x) => !valuesToExclude.includes(x)
`${localStorage.getItem("_appName")}_appeditor` );
) { if (rolesfiltered.length > 0) {
_currentRole = userRoles[1]; _currentRole = rolesfiltered[0];
} else { }
_currentRole = userRoles[0];
}
} else { } else {
_currentRole = userRoles[0]; const rolesfiltered = userRoles.filter(
(x) => !valuesToExclude.includes(x)
);
if (rolesfiltered.length > 0) {
_currentRole = userRoles[0];
} else {
_currentRole = "";
}
} }
if ( if (
_currentRole &&
_currentRole !== _currentRole !==
`${localStorage.getItem("_appName")}_appeditor` `${localStorage.getItem("_appName")}_appeditor`
) { ) {
userSettings.forEach(async (element) => { userSettings.forEach(async (element) => {
if (element.role === _currentRole) { if (element.role === _currentRole) {
@@ -581,7 +557,7 @@ function Login(props) {
); );
setThirdpartyLoader(false); setThirdpartyLoader(false);
setState({ ...state, loading: false }); setState({ ...state, loading: false });
navigate(`/`); navigate("/");
} else { } else {
extendedInfo.forEach((x) => { extendedInfo.forEach((x) => {
if (x.TenantId) { if (x.TenantId) {
@@ -619,6 +595,7 @@ function Login(props) {
); );
setThirdpartyLoader(false); setThirdpartyLoader(false);
setState({ ...state, loading: false }); setState({ ...state, loading: false });
if (process.env.REACT_APP_ENABLE_SUBSCRIPTION) {
if (billingDate) { if (billingDate) {
if (billingDate > new Date()) { if (billingDate > new Date()) {
localStorage.removeItem("userDetails"); localStorage.removeItem("userDetails");
@@ -632,6 +609,7 @@ function Login(props) {
navigate(`/subscription`); navigate(`/subscription`);
} }
} }
}
} else { } else {
localStorage.setItem("PageLanding", element.pageId); localStorage.setItem("PageLanding", element.pageId);
localStorage.setItem( localStorage.setItem(
@@ -641,6 +619,7 @@ function Login(props) {
localStorage.setItem("pageType", element.pageType); localStorage.setItem("pageType", element.pageType);
setState({ ...state, loading: false }); setState({ ...state, loading: false });
setThirdpartyLoader(false); setThirdpartyLoader(false);
if (process.env.REACT_APP_ENABLE_SUBSCRIPTION) {
if (billingDate) { if (billingDate) {
if (billingDate > new Date()) { if (billingDate > new Date()) {
localStorage.removeItem("userDetails"); localStorage.removeItem("userDetails");
@@ -654,27 +633,16 @@ function Login(props) {
navigate(`/subscription`); navigate(`/subscription`);
} }
} }
}, }
},
(error) => { (error) => {
/* alert( const payload = {
"You dont have access to this application." sessionToken: sessionToken
); */ };
setThirdpartyLoader(false); setThirdpartyLoader(false);
handleSubmitbtn(payload);
setState({ // localStorage.setItem("accesstoken", null);
...state,
loading: false,
toastColor: "#d9534f",
toastDescription:
"You dont have access to this application."
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
localStorage.setItem("accesstoken", null);
console.error("Error while fetching Follow", error); console.error("Error while fetching Follow", error);
} }
); );
@@ -682,47 +650,18 @@ function Login(props) {
}); });
} else { } else {
setThirdpartyLoader(false); setThirdpartyLoader(false);
setState({ setState({ ...state, loading: false });
...state,
loading: false,
toastColor: "#d9534f",
toastDescription: "User Role Not Found."
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
} }
} else { } else {
setThirdpartyLoader(false); setThirdpartyLoader(false);
setState({ setState({ ...state, loading: false });
...state,
loading: false,
toastColor: "#d9534f",
toastDescription: "User Role Not Found."
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
} }
}) })
.catch(() => { .catch((err) => {
console.log("err", err);
setThirdpartyLoader(false); setThirdpartyLoader(false);
setState({ setState({ ...state, loading: false });
...state,
loading: false,
toastColor: "#d9534f",
toastDescription: `Does not have permissions to access this application.`
});
const x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
}); });
} }
} catch (error) { } catch (error) {
@@ -744,7 +683,7 @@ function Login(props) {
}; };
const GetLoginData = async () => { const GetLoginData = async () => {
setState({ ...state, loading: true }) setState({ ...state, loading: true });
try { try {
Parse.serverURL = localStorage.getItem("baseUrl"); Parse.serverURL = localStorage.getItem("baseUrl");
Parse.initialize(localStorage.getItem("parseAppId")); Parse.initialize(localStorage.getItem("parseAppId"));
@@ -920,6 +859,80 @@ function Login(props) {
setState({ ...state, passwordVisible: !state.passwordVisible }); setState({ ...state, passwordVisible: !state.passwordVisible });
}; };
const handleSubmitbtn = async (e) => {
e.preventDefault();
if (userDetails.Destination && userDetails.Company) {
setThirdpartyLoader(true);
// console.log("handelSubmit", userDetails);
// const payload = await Parse.User.logIn(state.email, state.password);
const payload = { sessionToken: localStorage.getItem("accesstoken") };
const userInformation = JSON.parse(
localStorage.getItem("UserInformation")
);
// console.log("payload ", payload);
if (payload && payload.sessionToken) {
const params = {
userDetails: {
name: userInformation.name,
email: userInformation.email,
phone: userInformation.phone,
role: "contracts_User",
company: userDetails.Company,
jobTitle: userDetails.Destination
}
};
const userSignUp = await Parse.Cloud.run("usersignup", params);
// console.log("userSignUp ", userSignUp);
if (userSignUp && userSignUp.sessionToken) {
const LocalUserDetails = {
name: userInformation.name,
email: userInformation.email,
phone: userInformation.phone,
company: userDetails.Company,
jobTitle: userDetails.JobTitle
};
localStorage.setItem("userDetails", JSON.stringify(LocalUserDetails));
thirdpartyLoginfn(userSignUp.sessionToken);
} else {
alert(userSignUp.message);
}
} else if (
payload &&
payload.message.replace(/ /g, "_") === "Internal_server_err"
) {
alert("Internal server error !");
}
} else {
alert("Please fill required details!");
}
};
const handleCloseModal = () => {
setIsModal(false);
Parse.User.logOut();
let appdata = localStorage.getItem("userSettings");
let applogo = localStorage.getItem("appLogo");
let appName = localStorage.getItem("appName");
let defaultmenuid = localStorage.getItem("defaultmenuid");
let PageLanding = localStorage.getItem("PageLanding");
let domain = localStorage.getItem("domain");
let _appName = localStorage.getItem("_appName");
let baseUrl = localStorage.getItem("BaseUrl12");
let appid = localStorage.getItem("AppID12");
localStorage.clear();
localStorage.setItem("appLogo", applogo);
localStorage.setItem("appName", appName);
localStorage.setItem("_appName", _appName);
localStorage.setItem("defaultmenuid", defaultmenuid);
localStorage.setItem("PageLanding", PageLanding);
localStorage.setItem("domain", domain);
localStorage.setItem("userSettings", appdata);
localStorage.setItem("BaseUrl12", baseUrl);
localStorage.setItem("AppID12", appid);
};
return ( return (
<div className="bg-white"> <div className="bg-white">
<Title title={"Login Page"} /> <Title title={"Login Page"} />
@@ -944,7 +957,7 @@ function Login(props) {
color: "#3ac9d6", color: "#3ac9d6",
top: "50%", top: "50%",
left: "50%", left: "50%",
transform: 'translate(-50%, -50%)' transform: "translate(-50%, -50%)"
}} }}
className="loader-37" className="loader-37"
> >
@@ -953,132 +966,145 @@ function Login(props) {
</div> </div>
)} )}
{props.isloginVisible && props.isloginVisible ? ( {props.isloginVisible && props.isloginVisible ? (
<div aria-labelledby="loginHeading" role="region"> <>
<div className="md:m-10 lg:m-16 md:p-4 lg:p-10 p-5 bg-[#ffffff] md:border-[1px] md:border-gray-400 "> <div aria-labelledby="loginHeading" role="region">
<div className="w-[250px] h-[66px] inline-block"> <div className="md:m-10 lg:m-16 md:p-4 lg:p-10 p-4 bg-[#ffffff] md:border-[1px] md:border-gray-400 ">
{state.hideNav ? ( <div className="w-[250px] h-[66px] inline-block">
<img src={image} width="100%" alt="The image displays the OpenSign logo with a stylized blue square with an open corner, accompanied by the tagline Seal the Deal, Openly." /> <img
) : ( src={image}
<img src={image} width="100%" alt="The image displays the OpenSign logo with a stylized blue square with an open corner, accompanied by the tagline Seal the Deal, Openly." /> width="100%"
)} alt="The image displays the OpenSign logo with a stylized blue square with an open corner, accompanied by the tagline Seal the Deal, Openly."
</div> />
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-2"> </div>
<div> <div className="grid grid-cols-1 md:grid-cols-2 gap-x-2">
<div> <div>
<form onSubmit={handleSubmit} aria-label="Login Form"> <div>
<h1 className="text-[30px] mt-6">Welcome Back!</h1> <form onSubmit={handleSubmit} aria-label="Login Form">
<fieldset className="outline outline-1 outline-slate-300/50 my-4"> <h1 className="text-[30px] mt-6">Welcome Back!</h1>
<legend className="text-xs font-bold px-6 mt-4">Login to your account</legend> <fieldset>
<div className="px-6 py-4"> <legend className="text-[12px] text-[#878787]">
<label className="block text-xs" htmlFor="email">Username</label> Login to your account
<input </legend>
id="email" <div className="px-6 py-4 outline outline-1 outline-slate-300/50 my-2 rounded shadow-md">
type="text" <label className="block text-xs" htmlFor="email">
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs" Username
name="email" </label>
value={state.email}
onChange={handleChange}
required
/>
<hr className="my-2 border-none" />
<label className="block text-xs" htmlFor="password">Password</label>
<div className="relative">
<input <input
id="password" id="email"
type={state.passwordVisible ? "text" : "password"} type="text"
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs" className="px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs"
name="password" name="email"
value={state.password} value={state.email}
onChange={handleChange} onChange={handleChange}
required required
/> />
<span <hr className="my-2 border-none" />
className={`absolute top-[50%] right-[10px] -translate-y-[50%] cursor-pointer ${state.passwordVisible <label className="block text-xs" htmlFor="password">
? "text-[#007bff]" Password
: "text-black" </label>
<div className="relative">
<input
id="password"
type={state.passwordVisible ? "text" : "password"}
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs"
name="password"
value={state.password}
onChange={handleChange}
required
/>
<span
className={`absolute top-[50%] right-[10px] -translate-y-[50%] cursor-pointer ${
state.passwordVisible
? "text-[#007bff]"
: "text-black"
}`} }`}
onClick={togglePasswordVisibility} onClick={togglePasswordVisibility}
>
{state.passwordVisible ? (
<i className="fa fa-eye-slash text-xs pb-1" /> // Close eye icon
) : (
<i className="fa fa-eye text-xs pb-1 " /> // Open eye icon
)}
</span>
</div>
</div>
</fieldset>
<div className="flex flex-row justify-between items-center ml-4 py-2">
<div>
<label
className="form-check-label inline-block cursor-pointer"
htmlFor="rememberpassword"
> >
{state.passwordVisible ? ( <input
<i className="fa fa-eye-slash text-xs pb-1" /> // Close eye icon type="checkbox"
) : ( className="form-check-input mr-1"
<i className="fa fa-eye text-xs pb-1 " /> // Open eye icon value=""
)} id="rememberpassword"
</span> />
<span className="text-[13px]">
Remember Password
</span>
</label>
</div>
<div>
<NavLink
to="/forgetpassword"
className="text-[13px] underline focus:outline-none focus:ring-2 focus:ring-blue-600"
>
Forgot Password ?
</NavLink>
</div> </div>
</div> </div>
</fieldset> <div className="flex flex-col md:flex-row justify-between items-stretch gap-8 text-center text-xs font-bold mt-2">
<div className="flex flex-row justify-between items-center px-4 py-2"> <button
<div> type="submit"
<label className="form-check-label inline-block cursor-pointer" htmlFor="rememberpassword"> className="rounded-sm bg-[#3ac9d6] text-white w-full py-3 shadow outline-none uppercase focus:ring-2 focus:ring-blue-600"
<input disabled={state.loading}
type="checkbox"
className="form-check-input mr-2"
value=""
id="rememberpassword"
/>
<span className="text-[13px] pl-1">Remember Password</span>
</label>
</div>
<div>
<NavLink
to="/forgetpassword"
className="text-[13px] underline focus:outline-none focus:ring-2 focus:ring-blue-600"
> >
Forgot Password? {state.loading ? "Loading..." : "Login"}
</button>
<NavLink
className="rounded-sm cursor-pointer bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] w-full py-3 shadow uppercase"
to="/signup"
style={state.hideNav ? { textAlign: "center" } : {}}
>
Create Account
</NavLink> </NavLink>
</div> </div>
</div> </form>
<div className="flex flex-col md:flex-row justify-between items-stretch gap-8 text-center text-xs font-bold mt-2"> <br />
<button {(props.appInfo.fbAppId || props.appInfo.googleClietId) && (
type="submit" <div
className="rounded-sm bg-[#3ac9d6] text-white w-full py-3 shadow outline-none uppercase focus:ring-2 focus:ring-blue-600" style={{
disabled={state.loading} display: "flex",
alignItems: "center",
justifyContent: "center"
}}
className="text-sm"
> >
{state.loading ? "Loading..." : "Login"} <hr
</button> className={"border-[1px] border-gray-300 w-full"}
<NavLink style={{ color: "grey" }}
className="rounded-sm cursor-pointer bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] w-full py-3 shadow uppercase" />
to="/signup" <span style={{ color: "grey" }} className="px-2 ">
style={state.hideNav ? { textAlign: "center" } : {}} OR
> </span>
Create Account <hr
</NavLink> className={"border-[1px] border-gray-300 w-full"}
</div> style={{ color: "grey" }}
</form> />
<br /> </div>
{(props.appInfo.fbAppId || props.appInfo.googleClietId) && ( )}
<br />
<div <div
style={{ style={{
textAlign: "center",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center" justifyContent: "center"
}} }}
className="text-sm"
> >
<hr {/* {props.appInfo.fbAppId && props.appInfo.fbAppId !== "" ? (
className={"border-[1px] border-gray-300 w-full"}
style={{ color: "grey" }}
/>
<span style={{ color: "grey" }} className="px-2 ">
OR
</span>
<hr
className={"border-[1px] border-gray-300 w-full"}
style={{ color: "grey" }}
/>
</div>
)}
<br />
<div
style={{
textAlign: "center",
display: "flex",
alignItems: "center",
justifyContent: "center"
}}
>
{/* {props.appInfo.fbAppId && props.appInfo.fbAppId !== "" ? (
<LoginFacebook <LoginFacebook
FBCred={props.appInfo.fbAppId} FBCred={props.appInfo.fbAppId}
thirdpartyLoginfn={thirdpartyLoginfn} thirdpartyLoginfn={thirdpartyLoginfn}
@@ -1086,46 +1112,142 @@ function Login(props) {
setThirdpartyLoader={setThirdpartyLoader} setThirdpartyLoader={setThirdpartyLoader}
/> />
) : null} */} ) : null} */}
</div> </div>
<div style={{ margin: "10px 0" }}></div> <div style={{ margin: "10px 0" }}></div>
<div <div
style={{ style={{
textAlign: "center", textAlign: "center",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center" justifyContent: "center"
}} }}
> >
{props.appInfo.googleClietId && {props.appInfo.googleClietId &&
props.appInfo.googleClietId !== "" ? ( props.appInfo.googleClietId !== "" ? (
<GoogleSignInBtn <GoogleSignInBtn
GoogleCred={props.appInfo.googleClietId} GoogleCred={props.appInfo.googleClietId}
thirdpartyLoginfn={thirdpartyLoginfn} thirdpartyLoginfn={thirdpartyLoginfn}
thirdpartyLoader={state.thirdpartyLoader} thirdpartyLoader={state.thirdpartyLoader}
setThirdpartyLoader={setThirdpartyLoader} setThirdpartyLoader={setThirdpartyLoader}
/>
) : null}
</div>
</div>
</div>
{!state.hideNav && (
<div className="self-center">
<div className="mx-auto md:w-[300px] lg:w-[400px] xl:w-[500px]">
<img
src={login_img}
alt="The image illustrates a person from behind, seated at a desk with a four-monitor computer setup, in an environment with a light blue and white color scheme, featuring a potted plant to the right."
width="100%"
/> />
) : null} </div>
</div>
)}
</div>
</div>
<div
id="snackbar"
role="alert"
style={{ backgroundColor: state.toastColor }}
>
{state.toastDescription}
</div>
</div>
{isModal && (
<div
className="modal fade show"
id="exampleModal"
tabIndex="-1"
role="dialog"
style={{
display: "block",
zIndex: 1,
backgroundColor: "rgba(0,0,0,0.5)"
}}
>
<div className="modal-dialog" role="document">
<div className="modal-content">
<div className="modal-header">
<h5 className="modal-title">Login form</h5>
<span>
<span></span>
</span>
</div>
<div className="modal-body">
<form className="text-sm">
<div className="form-group">
<label
htmlFor="Company"
style={{ display: "flex" }}
className="col-form-label"
>
Company{" "}
<span style={{ fontSize: 13, color: "red" }}>*</span>
</label>
<input
type="text"
className="form-control"
id="Company"
value={userDetails.Company}
onChange={(e) =>
setUserDetails({
...userDetails,
Company: e.target.value
})
}
required
/>
</div>
<div className="form-group">
<label
htmlFor="Destination"
style={{ display: "flex" }}
className="col-form-label"
>
Destination{" "}
<span style={{ fontSize: 13, color: "red" }}>*</span>
</label>
<input
type="text"
className="form-control"
id="Destination"
value={userDetails.Destination}
onChange={(e) =>
setUserDetails({
...userDetails,
Destination: e.target.value
})
}
required
/>
</div>
<div className="mt-4">
<button
type="button"
className="bg-[#6c757d] text-sm p-2 text-white rounded uppercase"
onClick={handleCloseModal}
style={{ marginRight: 10, width: 90 }}
>
Cancel
</button>
<button
type="button"
className="bg-[#17a2b8] text-sm p-2 text-white rounded uppercase"
onClick={(e) => handleSubmitbtn(e)}
>
Login
</button>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
{!state.hideNav && (
<div className="self-center">
<div className="mx-auto md:w-[300px] lg:w-[500px]">
<img src={login_img} alt="The image illustrates a person from behind, seated at a desk with a four-monitor computer setup, in an environment with a light blue and white color scheme, featuring a potted plant to the right." width="100%" />
</div>
</div>
)}
</div> </div>
</div> )}
</>
<div
id="snackbar"
role="alert"
style={{ backgroundColor: state.toastColor }}
>
{state.toastDescription}
</div>
</div>
) : ( ) : (
<div <div
style={{ style={{
@@ -1140,7 +1262,6 @@ function Login(props) {
)} )}
</div> </div>
); );
// }
} }
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
+35 -5
View File
@@ -99,9 +99,38 @@ const Signup = (props) => {
} }
} }
}) })
.catch((err) => { .catch(async (err) => {
alert(err.message); if (err.code === 202) {
setState({ loading: false }); const userQuery = new Parse.Query("contracts_Users");
userQuery.equalTo("Email", email);
const res = await userQuery.first();
// console.log("Res ", res);
if (res) {
alert("User already exists with this username!");
setState({ loading: false });
} else {
let baseUrl = localStorage.getItem("BaseUrl12");
let parseAppId = localStorage.getItem("AppID12");
// console.log("state.email ", email);
try {
Parse.serverURL = baseUrl;
Parse.initialize(parseAppId);
await Parse.User.requestPasswordReset(email).then(
async function (res1) {
if (res1.data === undefined) {
alert("Email has been sent to your mail!");
}
}
);
} catch (err) {
console.log(err);
}
setState({ loading: false });
}
} else {
alert(err.message);
setState({ loading: false });
}
}); });
} catch (error) { } catch (error) {
console.log("err ", error); console.log("err ", error);
@@ -453,7 +482,7 @@ const Signup = (props) => {
<div className=""> <div className="">
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<h2 className="text-[30px] mt-6">Create Account !</h2> <h2 className="text-[30px] mt-6">Create Account !</h2>
<div className="shadow-md rounded my-4"> <div className="outline outline-1 outline-slate-300/50 shadow-md rounded my-4">
<div className="px-6 py-4 text-xs"> <div className="px-6 py-4 text-xs">
<label className="block "> <label className="block ">
Name{" "} Name{" "}
@@ -472,6 +501,7 @@ const Signup = (props) => {
<span style={{ color: "red", fontSize: 13 }}>*</span> <span style={{ color: "red", fontSize: 13 }}>*</span>
</label> </label>
<input <input
id="email"
type="text" type="text"
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded focus:outline-none text-xs" className="px-3 py-2 w-full border-[1px] border-gray-300 rounded focus:outline-none text-xs"
value={email} value={email}
@@ -563,7 +593,7 @@ const Signup = (props) => {
</div> </div>
{!state.hideNav && ( {!state.hideNav && (
<div className="self-center"> <div className="self-center">
<div className="mx-auto md:w-[300px] lg:w-[500px]"> <div className="mx-auto md:w-[300px] lg:w-[400px] xl:w-[500px]">
<img src={login_img} alt="bisec" width="100%" /> <img src={login_img} alt="bisec" width="100%" />
</div> </div>
</div> </div>
@@ -4,6 +4,12 @@ import multerS3 from 'multer-s3';
import aws from 'aws-sdk'; import aws from 'aws-sdk';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
function sanitizeFileName(fileName) {
// Remove spaces and invalid characters
return fileName.replace(/[^a-zA-Z0-9._-]/g, '');
}
async function uploadFile(req, res) { async function uploadFile(req, res) {
try { try {
//--size extended to 100 mb //--size extended to 100 mb
@@ -50,16 +56,28 @@ async function uploadFile(req, res) {
region: process.env.DO_REGION, region: process.env.DO_REGION,
}); });
// const s3 = new aws.S3(); const parseBaseUrl = process.env.SERVER_URL;
const upload = multer({ const parseAppId = process.env.APP_ID;
fileFilter: function (req, file, cb) {
if (accepted_extensions.some(ext => file.originalname.toLowerCase().endsWith('.' + ext))) { if (process.env.USE_LOCAL == "TRUE") {
return cb(null, true); var fileStorage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, "files/files");
},
metadata: function (req, file, cb) {
cb(null, { fieldName: 'OPENSIGN_METADATA' });
},
filename: function(req, file, cb) {
let filename = file.originalname;
let newFileName = filename.split('.')[0];
let extension = filename.split('.')[1];
newFileName = sanitizeFileName(newFileName + '_' + new Date().toISOString() + '.' + extension)
console.log(newFileName);
cb(null, newFileName);
} }
// otherwise, return error });
return cb('Only ' + accepted_extensions.join(', ') + ' files are allowed!'); } else {
}, var fileStorage = multerS3({
storage: multerS3({
acl: 'public-read', acl: 'public-read',
s3, s3,
bucket: DO_SPACE, bucket: DO_SPACE,
@@ -69,14 +87,25 @@ async function uploadFile(req, res) {
key: function (req, file, cb) { key: function (req, file, cb) {
//console.log(file); //console.log(file);
let filename = file.originalname; let filename = file.originalname;
let filenam = filename.split('.')[0]; let newFileName = filename.split('.')[0];
let extension = filename.split('.')[1]; let extension = filename.split('.')[1];
filenam = filenam + '_' + new Date().toISOString() + '.' + extension; newFileName = sanitizeFileName(newFileName + '_' + new Date().toISOString() + '.' + extension)
console.log(filenam); console.log(newFileName);
cb(null, filenam); cb(null, newFileName);
}, }
}), });
}
// const s3 = new aws.S3();
const upload = multer({
fileFilter: function (req, file, cb) {
if (accepted_extensions.some(ext => file.originalname.toLowerCase().endsWith('.' + ext))) {
return cb(null, true);
}
// otherwise, return error
return cb('Only ' + accepted_extensions.join(', ') + ' files are allowed!');
},
storage: fileStorage,
limits: { fileSize: size }, limits: { fileSize: size },
}).single('file'); }).single('file');
@@ -93,7 +122,14 @@ async function uploadFile(req, res) {
const status = 'Success'; const status = 'Success';
//res.header("Access-Control-Allow-Headers", "Content-Type"); //res.header("Access-Control-Allow-Headers", "Content-Type");
//res.setHeader("Access-Control-Allow-Origin", "*"); //res.setHeader("Access-Control-Allow-Origin", "*");
return res.json({ status, imageUrl: req.file.location }); if (process.env.USE_LOCAL == "TRUE") {
console.log(req.file);
var fileUrl = `${parseBaseUrl}/files/${parseAppId}/${req.file.filename}`;
} else {
var fileUrl = req.file.location;
}
return res.json({ status, imageUrl: fileUrl });
}); });
} catch (err) { } catch (err) {
console.log('Exeption in query ' + err.stack); console.log('Exeption in query ' + err.stack);
@@ -123,6 +123,9 @@ export default async function (request) {
if (userDetails && userDetails.company) { if (userDetails && userDetails.company) {
newObj.set("Company", userDetails.company); newObj.set("Company", userDetails.company);
} }
if (userDetails && userDetails.jobTitle) {
newObj.set("JobTitle", userDetails.jobTitle);
}
if (planDetails && planDetails.customer_id) { if (planDetails && planDetails.customer_id) {
newObj.set("Next_billing_date", new Date(planDetails.nextBillingDate)); newObj.set("Next_billing_date", new Date(planDetails.nextBillingDate));
newObj.set("Plan", planDetails.plan); newObj.set("Plan", planDetails.plan);
+55
View File
@@ -0,0 +1,55 @@
MIIKLwIBAzCCCeUGCSqGSIb3DQEHAaCCCdYEggnSMIIJzjCCBEIGCSqGSIb3DQEH
BqCCBDMwggQvAgEAMIIEKAYJKoZIhvcNAQcBMFcGCSqGSIb3DQEFDTBKMCkGCSqG
SIb3DQEFDDAcBAh6cQqVpHfTzAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQME
ASoEEFKEIGJTTRo3voO/FvsXs7yAggPAI7rMCboTFFBf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UcfdfVOzUfMnMGvO5danSrov6k/cFfLPH56ORb9Ep30a
U1fXHP+pcFQohR/kjAk5gjDUr8pjkOJ0/JHv106rptT4SNCznvJa8BvWtP9wDXDv
UZDA/UCLlnl20mJUjLtb0iM5vtqhi7XOxDoS8AauOimSEh+M0uLEZ7HOQvtGchLl
tDLd/DVew/WzPBhL4eNTmhwwno9JL21nPBEaFAa58djoiZXgzUdLQbBDbo/7nsRA
UJ9imt0HmhDU+xrimnMZJD051KcbohHjPvTnTb4qvd0Rt7u/dpL9NT07rQlVIe3u
qGl4sEe+1vEueRdHt5QCSGbxnwPPHdE9XMsK8et3M/DOYN+ToB9QmDm72lLsJNkm
0nxdYVpfXHUiPmMorkJgb9YXfY+j0UEWuT0l4bl7a5+mzGm/Zy9FCoLaW7MTWNJd
fyDSYsVotOhRdCBi0Osho21GldKmfX6XoqHYENVqsh7x9bgvjNwvLNgpCWXYh7/Q
K6N3iDQ3G3A6x9nOgeKpXYREd8fx8byM6u7FAttVTtcV71QaWU3TSn7Oice1Bklg
osIhUJydHny856D/WCD6EmnPBuukx9Tht8NKtJVS0XoXqbz69mx4xfq987HGkJJa
nvCgkZOr/LhcVylmRjg9ZVfiUrwim4Gp42gV3JtsZpOGE1m+1twSXShtr/PQ2FdF
jD41LOEG1OGdZ5XIDLxAI4085jwVD/WIRo/AZELENog1XKtjeXSqJ/H7njauB30w
MeNv0VRTIItVA0eXRDwoqjpqyGSdn9YF2SQ/qDR6WU+Y2bVD38m6ZJlsy/zHx9uc
sH1DK7hbbRRSuZ9Sx/TjD19DWJ4qNPTpUZTd0+dxsG/HGQKpkbpXI5f3aQ6nTWWM
MjlWF6mUI06iLIRhLyNwBrtEjJHL1k8fIOvO/MUKtj72VBGt/fnoutS0WifZLvfn
mFXB4iaMX0hGcgzpK4iNcg==
-----END ENCRYPTED PRIVATE KEY-----
Binary file not shown.
@@ -11,15 +11,13 @@ import { HTML5Backend } from "react-dnd-html5-backend";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import SignPad from "./component/signPad"; import SignPad from "./component/signPad";
import RenderAllPdfPage from "./component/renderAllPdfPage"; import RenderAllPdfPage from "./component/renderAllPdfPage";
import { import { getBase64FromIMG, getBase64FromUrl } from "../utils/Utils";
getBase64FromIMG,
getBase64FromUrl
} from "../utils/Utils";
import Loader from "./component/loader"; import Loader from "./component/loader";
import HandleError from "./component/HandleError"; import HandleError from "./component/HandleError";
import Nodata from "./component/Nodata"; import Nodata from "./component/Nodata";
import Header from "./component/header"; import Header from "./component/header";
import RenderPdf from "./component/renderPdf"; import RenderPdf from "./component/renderPdf";
import CustomModal from "./component/CustomModal";
function PdfRequestFiles() { function PdfRequestFiles() {
const { docId } = useParams(); const { docId } = useParams();
@@ -64,7 +62,8 @@ function PdfRequestFiles() {
const [isSigned, setIsSigned] = useState(false); const [isSigned, setIsSigned] = useState(false);
const [isExpired, setIsExpired] = useState(false); const [isExpired, setIsExpired] = useState(false);
const [alreadySign, setAlreadySign] = useState(false); const [alreadySign, setAlreadySign] = useState(false);
const [containerWH, setContainerWH] = useState({});
const divRef = useRef(null);
const rowLevel = const rowLevel =
localStorage.getItem("rowlevel") && localStorage.getItem("rowlevel") &&
JSON.parse(localStorage.getItem("rowlevel")); JSON.parse(localStorage.getItem("rowlevel"));
@@ -96,6 +95,14 @@ function PdfRequestFiles() {
getDocumentDetails(); getDocumentDetails();
} }
}, []); }, []);
useEffect(() => {
if (divRef.current) {
setContainerWH({
width: divRef.current.offsetWidth,
height: divRef.current.offsetHeight
});
}
}, [divRef.current]);
//function for get document details for perticular signer with signer'object id //function for get document details for perticular signer with signer'object id
const getDocumentDetails = async () => { const getDocumentDetails = async () => {
@@ -191,7 +198,7 @@ function PdfRequestFiles() {
//comparison auditTrail user details with signers user details //comparison auditTrail user details with signers user details
for (let i = 0; i < signerRes.length; i++) { for (let i = 0; i < signerRes.length; i++) {
const signerId = signerRes[i].objectId; const signerId = signerRes[i].objectId;
let isSigned = false; let isSigned = false;
for (let j = 0; j < checkDocIdExist.length; j++) { for (let j = 0; j < checkDocIdExist.length; j++) {
const signedExist = const signedExist =
@@ -912,6 +919,7 @@ function PdfRequestFiles() {
//function for set decline true on press decline button //function for set decline true on press decline button
const declineDoc = async () => { const declineDoc = async () => {
setIsDecline({ isDeclined: false });
const data = { const data = {
IsDeclined: true IsDeclined: true
}; };
@@ -983,7 +991,39 @@ function PdfRequestFiles() {
</div> </div>
)} )}
<div className="signatureContainer"> <div className="signatureContainer" ref={divRef}>
{/* this modal is used to show decline alert */}
<CustomModal
containerWH={containerWH}
show={isDecline.isDeclined}
headMsg="Document Declined Alert!"
bodyMssg={
isDecline.currnt === "Sure" ? (
<p className="pTagBody">
Are you sure want to decline this document ?
</p>
) : isDecline.currnt === "YouDeclined" ? (
<p className="pTagBody">You have declined this document!</p>
) : (
isDecline.currnt === "another" && (
<p className="pTagBody">
You cannot sign this document as it has been declined by
one or more person(s).
</p>
)
)
}
footerMessage={isDecline.currnt === "Sure"}
declineDoc={declineDoc}
setIsDecline={setIsDecline}
/>
{/* this modal is used for show expired alert */}
<CustomModal
containerWH={containerWH}
show={isExpired}
headMsg="Document Expired!"
bodyMssg="This Document is no longer available."
/>
{/* this component used to render all pdf pages in left side */} {/* this component used to render all pdf pages in left side */}
<RenderAllPdfPage <RenderAllPdfPage
signPdfUrl={pdfDetails[0].URL} signPdfUrl={pdfDetails[0].URL}
@@ -999,66 +1039,6 @@ function PdfRequestFiles() {
marginRight: pdfOriginalWidth > 500 && "20px" marginRight: pdfOriginalWidth > 500 && "20px"
}} }}
> >
<Modal show={isExpired}>
<ModalHeader className="bg-danger">
<span className="spanTagHead">Document Expired!</span>
</ModalHeader>
<Modal.Body>
<p className="pTagBody">
This Document is no longer available.
</p>
</Modal.Body>
</Modal>
{/* this modal is used for show decline alert */}
<Modal show={isDecline.isDeclined}>
<ModalHeader className="bg-danger">
<span className="spanTagHead">Document Declined Alert!</span>
</ModalHeader>
<Modal.Body>
{isDecline.currnt === "Sure" ? (
<p className="pTagBody">
Are you sure want to decline this document ?
</p>
) : isDecline.currnt === "YouDeclined" ? (
<p className="pTagBody">You have declined this document!</p>
) : (
isDecline.currnt === "another" && (
<p className="pTagBody">
You cannot sign this document as it has been declined by
one or more person(s).
</p>
)
)}
</Modal.Body>
<Modal.Footer>
{isDecline.currnt === "Sure" && (
<>
<button
style={{
color: "black"
}}
type="button"
className="finishBtn"
onClick={() => setIsDecline({ isDeclined: false })}
>
Close
</button>
<button
style={{
background: "#de4337"
}}
type="button"
className="finishBtn"
onClick={() => declineDoc()}
>
Yes
</button>
</>
)}
</Modal.Footer>
</Modal>
{/* this modal is used show this document is already sign */} {/* this modal is used show this document is already sign */}
<Modal show={isCompleted.isModal}> <Modal show={isCompleted.isModal}>
@@ -0,0 +1,59 @@
import React from "react";
import "../../css/customModal.css";
import "../../css/signature.css";
function CustomModal({
show,
headMsg,
bodyMssg,
footerMessage,
declineDoc,
setIsDecline,
containerWH
}) {
const isMobile = window.innerWidth < 767;
return (
show && (
<div
className="parentDiv"
style={{
width: containerWH && containerWH.width,
height: isMobile ? "100%" : containerWH && containerWH.height
}}
>
<div className="childDiv">
<div className="modalHeadDiv bg-danger">{headMsg && headMsg}</div>
<div className="modalBodyDIv">
<p className="pTagBody">{bodyMssg && bodyMssg}</p>
</div>
{footerMessage && (
<div className="modalFooterDiv">
<button
style={{
color: "black"
}}
type="button"
className="finishBtn"
onClick={() => setIsDecline({ isDeclined: false })}
>
Close
</button>
<button
style={{
background: "#de4337"
}}
type="button"
className="finishBtn"
onClick={() => declineDoc()}
>
Yes
</button>
</div>
)}
</div>
</div>
)
);
}
export default CustomModal;
@@ -1,5 +1,5 @@
import React, { useEffect } from "react"; import React from "react";
import axios from "axios";
function DefaultSignature({ function DefaultSignature({
themeColor, themeColor,
@@ -26,7 +26,7 @@ function EmailComponent({
//function for send email //function for send email
const sendEmail = async () => { const sendEmail = async () => {
setIsLoading(true); setIsLoading(true);
let sendMail, recipent; let sendMail;
for (let i = 0; i < emailCount.length; i++) { for (let i = 0; i < emailCount.length; i++) {
try { try {
@@ -37,7 +37,7 @@ function Header({
}) { }) {
const isMobile = window.innerWidth < 767; const isMobile = window.innerWidth < 767;
const navigate = useNavigate(); const navigate = useNavigate();
const isGuestSigner = localStorage.getItem("isGuestSigner");
//for go to previous page //for go to previous page
function previousPage() { function previousPage() {
changePage(-1); changePage(-1);
@@ -81,14 +81,16 @@ function Header({
return ( return (
<div <div
style={{ paddingBottom: "5px", paddingTop: "5px" }} style={{ padding: !isGuestSigner && "5px 0px 5px 0px" }}
className="mobileHead" className="mobileHead"
> >
{isMobile && isShowHeader ? ( {isMobile && isShowHeader ? (
<div <div
id="navbar" id="navbar"
className="stickyHead" className={isGuestSigner ? "stickySignerHead" : "stickyHead"}
style={{ width: window.innerWidth - 30 + "px" }} style={{
width: isGuestSigner ? window.innerWidth : window.innerWidth - 30 + "px"
}}
> >
<div className="preBtn2"> <div className="preBtn2">
<div <div
@@ -42,8 +42,42 @@ function RenderPdf({
const isMobile = window.innerWidth < 767; const isMobile = window.innerWidth < 767;
const newWidth = window.innerWidth; const newWidth = window.innerWidth;
const scale = isMobile ? pdfOriginalWidth / newWidth : 1; const scale = isMobile ? pdfOriginalWidth / newWidth : 1;
//function for render placeholder block over pdf document
// handle signature block width and height according to screen
const posWidth = (pos) => {
let width;
if (isMobile) {
if (!pos.isMobile) {
width = pos.Width / scale ? pos.Width / scale : 150 / scale;
return width;
} else {
width = pos.Width ? pos.Width : 150;
return width;
}
} else {
width = pos.Width ? pos.Width : 150;
return width;
}
};
const posHeight = (pos) => {
let width;
if (isMobile) {
if (!pos.isMobile) {
width = pos.Height / scale ? pos.Height / scale : 60 / scale;
return width;
} else {
width = pos.Height ? pos.Height : 60;
return width;
}
} else {
width = pos.Height ? pos.Height : 60;
return width;
}
};
//check isGuestSigner is present in local if yes than handle login flow header in mobile view
const isGuestSigner = localStorage.getItem("isGuestSigner");
//function for render placeholder block over pdf document
const checkSignedSignes = (data) => { const checkSignedSignes = (data) => {
const checkSign = signedSigners.filter( const checkSign = signedSigners.filter(
(sign) => sign.objectId === data.signerObjId (sign) => sign.objectId === data.signerObjId
@@ -56,7 +90,7 @@ function RenderPdf({
if (isMobile) { if (isMobile) {
//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
if (!pos.isMobile) { if (!pos.isMobile) {
return pos.xPosition / scale; return pos.xPosition / scale - 20;
} }
//pos.isMobile true -- placeholder save from mobile view(small device) handle position in mobile view(small screen) view divided by scale //pos.isMobile true -- placeholder save from mobile view(small device) handle position in mobile view(small screen) view divided by scale
else { else {
@@ -134,8 +168,8 @@ function RenderPdf({
borderWidth: "0.2px" borderWidth: "0.2px"
}} }}
size={{ size={{
width: pos.Width ? pos.Width : 150, width: posWidth(pos),
height: pos.Height ? pos.Height : 60 height: posHeight(pos)
}} }}
lockAspectRatio={pos.Width && 2.5} lockAspectRatio={pos.Width && 2.5}
default={{ default={{
@@ -205,8 +239,8 @@ function RenderPdf({
y: yPos(pos) y: yPos(pos)
}} }}
size={{ size={{
width: pos.Width ? pos.Width : 150, width: posWidth(pos),
height: pos.Height ? pos.Height : 60 height: posHeight(pos)
}} }}
lockAspectRatio={pos.Width ? pos.Width / pos.Height : 2.5} lockAspectRatio={pos.Width ? pos.Width / pos.Height : 2.5}
> >
@@ -235,7 +269,8 @@ function RenderPdf({
{isMobile && scale ? ( {isMobile && scale ? (
<div <div
style={{ style={{
border: "0.1px solid #ebe8e8" border: "0.1px solid #ebe8e8",
marginTop: isGuestSigner && "30px"
}} }}
ref={drop} ref={drop}
id="container" id="container"
@@ -294,12 +329,11 @@ function RenderPdf({
borderWidth: "0.2px" borderWidth: "0.2px"
}} }}
size={{ size={{
width: pos.Width ? pos.Width : 150, width: posWidth(pos),
height: pos.Height ? pos.Height : 60 height: posHeight(pos)
}} }}
lockAspectRatio={pos.Width && 2.5} lockAspectRatio={pos.Width && 2.5}
//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divide by scale //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divide by scale
//else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
default={{ default={{
x: !pos.isMobile x: !pos.isMobile
@@ -361,14 +395,13 @@ function RenderPdf({
borderWidth: "0.2px" borderWidth: "0.2px"
}} }}
size={{ size={{
width: pos.Width ? pos.Width : 150, width: posWidth(pos),
height: pos.Height ? pos.Height : 60 height: posHeight(pos)
}} }}
disableDragging={true} disableDragging={true}
default={{ default={{
//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divide by scale //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divide by scale
//else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
x: !pos.isMobile x: !pos.isMobile
? pos.xPosition / scale ? pos.xPosition / scale
: pos.xPosition * (pos.scale / scale) - 50, : pos.xPosition * (pos.scale / scale) - 50,
@@ -1281,4 +1314,4 @@ function RenderPdf({
); );
} }
export default RenderPdf; export default RenderPdf;
@@ -38,19 +38,15 @@ function Login() {
const handleChange = (event) => { const handleChange = (event) => {
const { value } = event.target; const { value } = event.target;
setOTP(value); setOTP(value);
}; };
//send email OTP function //send email OTP function
const SendOtp = async (e) => { const SendOtp = async (e) => {
const serverUrl = const serverUrl =
localStorage.getItem("baseUrl") && localStorage.getItem("baseUrl"); localStorage.getItem("baseUrl") && localStorage.getItem("baseUrl");
const parseId = const parseId =
localStorage.getItem("parseAppId") && localStorage.getItem("parseAppId"); localStorage.getItem("parseAppId") && localStorage.getItem("parseAppId");
if (serverUrl && localStorage) { if (serverUrl && localStorage) {
setLoading(true); setLoading(true);
e.preventDefault(); e.preventDefault();
@@ -84,13 +80,10 @@ function Login() {
e.preventDefault(); e.preventDefault();
const serverUrl = const serverUrl =
localStorage.getItem("baseUrl") && localStorage.getItem("baseUrl"); localStorage.getItem("baseUrl") && localStorage.getItem("baseUrl");
const parseId = const parseId =
localStorage.getItem("parseAppId") && localStorage.getItem("parseAppId"); localStorage.getItem("parseAppId") && localStorage.getItem("parseAppId");
if (OTP) { if (OTP) {
setLoading(true); setLoading(true);
try { try {
let url = `${serverUrl}functions/AuthLoginAsMail/`; let url = `${serverUrl}functions/AuthLoginAsMail/`;
const headers = { const headers = {
@@ -102,7 +95,6 @@ function Login() {
otp: OTP otp: OTP
}; };
let user = await axios.post(url, body, { headers: headers }); let user = await axios.post(url, body, { headers: headers });
if (user.data.result === "Invalid Otp") { if (user.data.result === "Invalid Otp") {
alert("Invalid Otp"); alert("Invalid Otp");
setLoading(false); setLoading(false);
@@ -114,10 +106,12 @@ function Login() {
localStorage.setItem("UserInformation", JSON.stringify(_user)); localStorage.setItem("UserInformation", JSON.stringify(_user));
localStorage.setItem("username", _user.name); localStorage.setItem("username", _user.name);
localStorage.setItem("accesstoken", _user.sessionToken); localStorage.setItem("accesstoken", _user.sessionToken);
//save isGuestSigner true in local to handle login flow header in mobile view
localStorage.setItem("isGuestSigner", true);
setLoading(false); setLoading(false);
//navigate user to on signature page navigate(
// navigate(`/recipientSignPdf/${id}/${contactBookId}`); `/loadmf/signmicroapp/recipientSignPdf/${id}/${contactBookId}`
navigate(`/loadmf/signmicroapp/recipientSignPdf/${id}/${contactBookId}`); );
} }
} catch (error) {} } catch (error) {}
} else { } else {
@@ -173,9 +167,7 @@ function Login() {
<span className="KNLO"> <span className="KNLO">
Verification code is sent to your email Verification code is sent to your email
</span> </span>
<div className="card card-box" <div className="card card-box" style={{ borderRadius: "0px" }}>
style={{borderRadius:"0px"}}
>
<div className="card-body"> <div className="card-body">
<input <input
type="email" type="email"
@@ -190,7 +182,6 @@ function Login() {
<div className="btnContainer"> <div className="btnContainer">
{loading ? ( {loading ? (
<button <button
// className="btn btn-info loadinBtn "
type="button" type="button"
style={{ style={{
background: themeColor(), background: themeColor(),
@@ -214,15 +205,7 @@ function Login() {
color: "white", color: "white",
marginLeft: "0px !important" marginLeft: "0px !important"
}} }}
// className="btn btn-sm otpButton"
onClick={(e) => SendOtp(e)} onClick={(e) => SendOtp(e)}
// style={{
// marginBottom: "4px",
// width: "210px",
// background: themeColor(),
// color: "white",
// fontWeight: "600"
// }}
> >
Send OTP Send OTP
</button> </button>
@@ -952,7 +952,7 @@ function PlaceHolderSign() {
background: themeColor() background: themeColor()
}} }}
> >
<span style={{ color: "white" }}>Send Mail </span> <span style={{ color: "white" }}>Mails Sent</span>
</Modal.Header> </Modal.Header>
{/* signature modal */} {/* signature modal */}
@@ -23,8 +23,8 @@ import Loader from "./component/loader";
import HandleError from "./component/HandleError"; import HandleError from "./component/HandleError";
import Nodata from "./component/Nodata"; import Nodata from "./component/Nodata";
import Header from "./component/header"; import Header from "./component/header";
import ModalComponent from "./component/modalComponent";
import RenderPdf from "./component/renderPdf"; import RenderPdf from "./component/renderPdf";
import CustomModal from "./component/CustomModal";
function EmbedPdfImage() { function EmbedPdfImage() {
const { id, contactBookId } = useParams(); const { id, contactBookId } = useParams();
const [isSignPad, setIsSignPad] = useState(false); const [isSignPad, setIsSignPad] = useState(false);
@@ -67,13 +67,15 @@ function EmbedPdfImage() {
status: false, status: false,
type: "load" type: "load"
}); });
const [containerWH, setContainerWH] = useState({});
const docId = id && id; const docId = id && id;
const isMobile = window.innerWidth < 767; const isMobile = window.innerWidth < 767;
const index = xyPostion.findIndex((object) => { const index = xyPostion.findIndex((object) => {
return object.pageNumber === pageNumber; return object.pageNumber === pageNumber;
}); });
const divRef = useRef(null);
//check isGuestSigner is present in local if yes than handle login flow header in mobile view
const isGuestSigner = localStorage.getItem("isGuestSigner");
useEffect(() => { useEffect(() => {
const clientWidth = window.innerWidth; const clientWidth = window.innerWidth;
const pdfWidth = clientWidth - 160 - 220 - 30; const pdfWidth = clientWidth - 160 - 220 - 30;
@@ -82,6 +84,14 @@ function EmbedPdfImage() {
setPdfNewWidth(pdfWidth); setPdfNewWidth(pdfWidth);
getDocumentDetails(); getDocumentDetails();
}, []); }, []);
useEffect(() => {
if (divRef.current) {
setContainerWH({
width: divRef.current.offsetWidth,
height: divRef.current.offsetHeight
});
}
}, [divRef.current]);
//function for get document details for perticular signer with signer'object id //function for get document details for perticular signer with signer'object id
const getDocumentDetails = async () => { const getDocumentDetails = async () => {
@@ -952,7 +962,37 @@ function EmbedPdfImage() {
) : noData ? ( ) : noData ? (
<Nodata /> <Nodata />
) : ( ) : (
<div className="signatureContainer"> <div className="signatureContainer" ref={divRef}>
{/* this modal is used to show decline alert */}
<CustomModal
containerWH={containerWH}
show={isDecline.isDeclined}
headMsg="Document Declined Alert!"
bodyMssg={
isDecline.currnt === "Sure" ? (
<p>Are you sure want to decline this document ?</p>
) : isDecline.currnt === "YouDeclined" ? (
<p>You have declined this document!</p>
) : (
isDecline.currnt === "another" && (
<p>
You cannot sign this document as it has been declined by one
or more person(s).
</p>
)
)
}
footerMessage={isDecline.currnt === "Sure"}
declineDoc={declineDoc}
setIsDecline={setIsDecline}
/>
{/* this modal is used for show expired alert */}
<CustomModal
containerWH={containerWH}
show={isExpired}
headMsg="Document Expired!"
bodyMssg="This Document is no longer available."
/>
{/* this component used for UI interaction and show their functionality */} {/* this component used for UI interaction and show their functionality */}
{pdfLoadFail.status && {pdfLoadFail.status &&
!isExpired && !isExpired &&
@@ -971,61 +1011,10 @@ function EmbedPdfImage() {
{/* pdf render view */} {/* pdf render view */}
<div <div
style={{ style={{
marginLeft: pdfOriginalWidth > 500 && "20px", marginLeft: !isGuestSigner && pdfOriginalWidth > 500 && "20px",
marginRight: pdfOriginalWidth > 500 && "20px" marginRight: !isGuestSigner && pdfOriginalWidth > 500 && "20px"
}} }}
> >
{/* this modal is used for show decline alert */}
<Modal show={isDecline.isDeclined}>
<ModalHeader className="bg-danger" style={{ color: "white" }}>
Document Declined Alert!
</ModalHeader>
<Modal.Body>
{isDecline.currnt === "Sure" ? (
<p>Are you sure want to decline this document ?</p>
) : isDecline.currnt === "YouDeclined" ? (
<p>You have declined this document!</p>
) : (
isDecline.currnt === "another" && (
<p>
You cannot sign this document as it has been declined by
one or more person(s).
</p>
)
)}
</Modal.Body>
<Modal.Footer>
{isDecline.currnt === "Sure" && (
<>
<button
style={{
color: "black"
}}
type="button"
className="finishBtn"
onClick={() => setIsDecline({ isDeclined: false })}
>
Close
</button>
<button
style={{
background: "#de4337"
}}
type="button"
className="finishBtn"
onClick={() => declineDoc()}
>
Yes
</button>
</>
)}
</Modal.Footer>
</Modal>
{/* this modal component is used for show expired document */}
<ModalComponent isShow={isExpired} type={"expire"} />
{/* this modal is used show this document is already sign */} {/* this modal is used show this document is already sign */}
<Modal show={isAlreadySign.status}> <Modal show={isAlreadySign.status}>
<ModalHeader style={{ background: themeColor() }}> <ModalHeader style={{ background: themeColor() }}>
@@ -1138,9 +1127,9 @@ function EmbedPdfImage() {
)} )}
</div> </div>
)} )}
{/* ndD5gdaxqw */}
</DndProvider> </DndProvider>
); );
} }
export default EmbedPdfImage; export default EmbedPdfImage;
@@ -0,0 +1,59 @@
.parentDiv {
background: gray;
position: absolute;
z-index: 20;
background-color: rgba(0, 0, 0, 0.75);
display: flex;
flex-direction: column;
align-items: center;
}
.childDiv {
width: 50%;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
background-color: #fff;
margin: 30px 20px;
border: 0px 1px 1px 1px solid rgba(0, 0, 0, .2);
border-radius: 0.3rem;
outline: 0;
}
.modalHeadDiv {
padding: 10px;
color: #fff;
border-top-left-radius: 0.3rem;
border-top-right-radius: 0.3rem;
font-size: 17px;
font-weight: 500;
}
.modalBodyDIv {
padding: 20px;
}
.spanTagHead {
color: white !important;
font-size: 17px;
font-weight: 500;
}
.pTagBody {
font-size: 15px !important;
}
.modalFooterDiv {
margin: 10px;
display: flex;
justify-content: flex-end;
}
@media screen and (max-width:500px) {
.childDiv {
margin: 50px 7px;
width: 90%;
}
}
File diff suppressed because it is too large Load Diff
+22 -16
View File
@@ -57,37 +57,41 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {
(data, ind) => (data, ind) =>
data.key === signKey && data.Width && data.Height && data.SignUrl data.key === signKey && data.Width && data.Height && data.SignUrl
); );
if (updateFilter.length > 0) { if (updateFilter.length > 0) {
let newWidth, nweHeight; let newWidth, newHeight;
const aspectRatio = imgWH.width / imgWH.height; const aspectRatio = imgWH.width / imgWH.height;
const getXYdata = xyPostion[index].pos; const getXYdata = xyPostion[index].pos;
if (aspectRatio === 1) { if (aspectRatio === 1) {
newWidth = aspectRatio * 100; newWidth = aspectRatio * 100;
nweHeight = aspectRatio * 100; newHeight = aspectRatio * 100;
} else if (aspectRatio < 2) { } else if (aspectRatio < 2) {
newWidth = aspectRatio * 100; newWidth = aspectRatio * 100;
nweHeight = 100; newHeight = 100;
} else if (aspectRatio > 2 && aspectRatio < 4) { } else if (aspectRatio > 2 && aspectRatio < 4) {
newWidth = aspectRatio * 70; newWidth = aspectRatio * 70;
nweHeight = 70; newHeight = 70;
} else if (aspectRatio > 4) { } else if (aspectRatio > 4) {
newWidth = aspectRatio * 40; newWidth = aspectRatio * 40;
nweHeight = 40; newHeight = 40;
} else if (aspectRatio > 5) { } else if (aspectRatio > 5) {
newWidth = aspectRatio * 10; newWidth = aspectRatio * 10;
nweHeight = 10; newHeight = 10;
} }
let getPosData = xyPostion[index].pos.filter((data) => data.key === signKey); let getPosData = xyPostion[index].pos.filter(
(data) => data.key === signKey
);
const addSign = getXYdata.map((url, ind) => { const addSign = getXYdata.map((url, ind) => {
if (url.key === signKey) { if (url.key === signKey) {
return { return {
...url, ...url,
Width: getPosData[0].Width ? getPosData[0].Width : 150, Width: getPosData[0].Width ? getPosData[0].Width : newWidth,
Height: getPosData[0].Height ? getPosData[0].Height : 60, Height: getPosData[0].Height ? getPosData[0].Height : newHeight,
SignUrl: image.src, SignUrl: image.src,
ImageType: image.imgType ImageType: image.imgType
}; };
@@ -106,7 +110,9 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {
} else { } else {
const getXYdata = xyPostion[index].pos; const getXYdata = xyPostion[index].pos;
let getPosData = xyPostion[index].pos.filter((data) => data.key === signKey); let getPosData = xyPostion[index].pos.filter(
(data) => data.key === signKey
);
const aspectRatio = imgWH.width / imgWH.height; const aspectRatio = imgWH.width / imgWH.height;
let newWidth, newHeight; let newWidth, newHeight;
@@ -131,9 +137,9 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {
if (url.key === signKey) { if (url.key === signKey) {
return { return {
...url, ...url,
Width: getPosData[0].Width ? getPosData[0].Width : 150, Width: getPosData[0].Width ? getPosData[0].Width : newWidth,
Height: getPosData[0].Height ? getPosData[0].Height : 60, Height: getPosData[0].Height ? getPosData[0].Height : newHeight,
SignUrl: image.src, SignUrl: image.src,
ImageType: image.imgType ImageType: image.imgType
}; };
} }