diff --git a/apps/OpenSign/src/App.js b/apps/OpenSign/src/App.js index 500e00808..d1555f8bf 100644 --- a/apps/OpenSign/src/App.js +++ b/apps/OpenSign/src/App.js @@ -15,6 +15,7 @@ import ForgetPassword from "./routes/ForgetPassword"; import ChangePassword from "./routes/ChangePassword"; import ReportMicroapp from "./components/ReportMicroapp"; import LoadMf from "./routes/LoadMf"; +import ValidateRoute from "./layout/ValidateRoute"; function App() { const [isloading, setIsLoading] = useState(true); @@ -58,8 +59,24 @@ function App() { ) : ( - } /> - } /> + + + + } + /> + + + + } + /> } /> } /> {process.env.REACT_APP_ENABLE_SUBSCRIPTION && ( diff --git a/apps/OpenSign/src/layout/HomeLayout.js b/apps/OpenSign/src/layout/HomeLayout.js index 5583df9c5..c877b90a7 100644 --- a/apps/OpenSign/src/layout/HomeLayout.js +++ b/apps/OpenSign/src/layout/HomeLayout.js @@ -7,10 +7,35 @@ import Tour from "reactour"; import axios from "axios"; import { useSelector } from "react-redux"; import Parse from "parse"; +import ModalUi from "../primitives/ModalUi"; +import { useNavigate } from "react-router-dom"; + const HomeLayout = ({ children }) => { + const navigate = useNavigate(); const { width } = useWindowSize(); const [isOpen, setIsOpen] = useState(true); const arr = useSelector((state) => state.TourSteps); + const [isUserValid, setIsUserValid] = useState(true); + + useEffect(() => { + (async () => { + try { + // Use the session token to validate the user + const userQuery = new Parse.Query(Parse.User); + const user = await userQuery.get(Parse.User.current().id, { + sessionToken: localStorage.getItem("accesstoken") + }); + if (user) { + setIsUserValid(true); + } else { + setIsUserValid(false); + } + } catch (error) { + // Session token is invalid or there was an error + setIsUserValid(false); + } + })(); + }, []); // reactour state const [isCloseBtn, setIsCloseBtn] = useState(true); @@ -19,7 +44,7 @@ const HomeLayout = ({ children }) => { const [tourConfigs, setTourConfigs] = useState([]); const showSidebar = () => { - setIsOpen(value => !value); + setIsOpen((value) => !value); }; useEffect(() => { if (width && width <= 768) { @@ -28,9 +53,7 @@ const HomeLayout = ({ children }) => { }, [width]); useEffect(() => { - if (localStorage.getItem("domain") === "sign" && arr && arr.length > 0) { - handleDynamicSteps(); - } else if ( + if ( localStorage.getItem("domain") === "contracts" && arr && arr.length > 0 @@ -153,32 +176,58 @@ const HomeLayout = ({ children }) => { setIsOpen(false); } }; + + const handleLoginBtn = () => { + Parse.User.logOut(); + navigate("/", { replace: true }); + }; return (
-
- + {isUserValid ? ( + <> +
+ -
-
{children}
-
-
+
+
{children}
+
+
+
+
-
-
- + + + ) : ( + +
+

Your Session has Expired.

+ +
+
+ )}
); }; diff --git a/apps/OpenSign/src/layout/ValidateRoute.js b/apps/OpenSign/src/layout/ValidateRoute.js new file mode 100644 index 000000000..e1b1b8825 --- /dev/null +++ b/apps/OpenSign/src/layout/ValidateRoute.js @@ -0,0 +1,25 @@ +import React, { useEffect } from "react"; +import Parse from "parse"; + +const ValidateRoute = ({ children }) => { + useEffect(() => { + (async () => { + try { + // Use the session token to validate the user + const userQuery = new Parse.Query(Parse.User); + const user = await userQuery.get(Parse.User.current().id, { + sessionToken: localStorage.getItem("accesstoken") + }); + if (!user) { + Parse.User.logOut(); + } + } catch (error) { + // Session token is invalid or there was an error + Parse.User.logOut(); + } + })(); + }, []); + return
{children}
; +}; + +export default ValidateRoute; diff --git a/apps/OpenSign/src/primitives/ModalUi.js b/apps/OpenSign/src/primitives/ModalUi.js index f5926e081..c3e1721cf 100644 --- a/apps/OpenSign/src/primitives/ModalUi.js +++ b/apps/OpenSign/src/primitives/ModalUi.js @@ -1,21 +1,35 @@ import React from "react"; -const ModalUi = ({ children, title, isOpen, handleClose }) => { - +const ModalUi = ({ + children, + title, + isOpen, + headColor, + handleClose, + showHeader = true, + showClose = true +}) => { return ( <> {isOpen && (
-
-
{title}
+ {showHeader && (
handleClose && handleClose()} + className="flex justify-between rounded-t items-center py-[15px] px-[20px] text-white" + style={{ background: headColor ? headColor : "#32a3ac" }} > - × +
{title}
+ {showClose && ( +
handleClose && handleClose()} + > + × +
+ )}
-
-
{children}
+ )} +
{children}
)} diff --git a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs index 9c33a5102..774855dc6 100644 --- a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs +++ b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs @@ -32,7 +32,7 @@ exports.up = async Parse => { objectId: 'sHAnZphf69', }, { - icon: 'fas fa-file-signature', + icon: 'fa-solid fa-paper-plane', title: 'Request signatures', target: '_self', pageType: 'form', @@ -50,7 +50,7 @@ exports.up = async Parse => { ], }, { - icon: 'fas fa-file-signature', + icon: 'fa-solid fa-file-contract', title: 'Templates', target: '_self', pageType: 'report', @@ -181,23 +181,30 @@ exports.up = async Parse => { objectId: 'sHAnZphf69', }, { - icon: 'fas fa-file-signature', + icon: 'fa-solid fa-paper-plane', title: 'Request signatures', target: '_self', pageType: 'form', description: '', objectId: '8mZzFxbG1z', }, + { + icon: 'fas fa-file-signature', + title: 'New template', + target: '_self', + pageType: 'form', + description: '', + objectId: 'template', + }, ], }, { - icon: 'fas fa-folder', - title: 'OpenSignDrive™', + icon: 'fa-solid fa-file-contract', + title: 'Templates', target: '_self', - pageType: 'mf', + pageType: 'report', description: '', - objectId: - 'remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9TaWduLU1pY3JvYXBwVjIvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/legadrive', + objectId: '6TeaPr321t', }, { icon: 'fas fa-address-card', diff --git a/microfrontends/SignDocuments/src/Component/component/EditTemplate.js b/microfrontends/SignDocuments/src/Component/component/EditTemplate.js index 883051507..f60091c6d 100644 --- a/microfrontends/SignDocuments/src/Component/component/EditTemplate.js +++ b/microfrontends/SignDocuments/src/Component/component/EditTemplate.js @@ -43,7 +43,7 @@ const EditTemplate = ({ template, onSuccess }) => { fontWeight: "700" }} > - file selected : {template.URL?.split("/")[3]?.split("_")[1]} + {template.URL?.split("/")[3]?.split("_")[1]}
diff --git a/microfrontends/SignDocuments/src/Component/component/LinkUserModal.js b/microfrontends/SignDocuments/src/Component/component/LinkUserModal.js index 5b14264bb..b7a5cac97 100644 --- a/microfrontends/SignDocuments/src/Component/component/LinkUserModal.js +++ b/microfrontends/SignDocuments/src/Component/component/LinkUserModal.js @@ -10,12 +10,12 @@ const LinkUserModal = (props) => { details={props.handleAddUser} closePopup={props.closePopup} /> -
+
or @@ -23,7 +23,7 @@ const LinkUserModal = (props) => { style={{ height: 1, width: "100%", - backgroundColor: "grey" + backgroundColor: "#ccc" }} >
diff --git a/microfrontends/SignDocuments/src/css/AddUser.css b/microfrontends/SignDocuments/src/css/AddUser.css index 0e52ba2a0..00576a9fc 100644 --- a/microfrontends/SignDocuments/src/css/AddUser.css +++ b/microfrontends/SignDocuments/src/css/AddUser.css @@ -1,6 +1,6 @@ .addusercontainer { height: 100%; - padding: 20px; + padding: 10px 20px 10px 20px; } .loaderdiv { diff --git a/microfrontends/SignDocuments/src/premitives/SelectSigners.js b/microfrontends/SignDocuments/src/premitives/SelectSigners.js index 88b188842..6c207f36a 100644 --- a/microfrontends/SignDocuments/src/premitives/SelectSigners.js +++ b/microfrontends/SignDocuments/src/premitives/SelectSigners.js @@ -87,10 +87,9 @@ const SelectSigners = (props) => { />
{isError ?

Please select signer

:

.

} - -
+