Skip to content

🔥 The free & Open Source DocuSign alternative

fix: issue of owner subscription has expired in guest login

prafull-opensignlabs960fbdb0eb15
diff --git a/apps/OpenSign/src/components/AddSigner.js b/apps/OpenSign/src/components/AddSigner.js
index a44a80026..5b0db6873 100644
--- a/apps/OpenSign/src/components/AddSigner.js
+++ b/apps/OpenSign/src/components/AddSigner.js
@@ -49,6 +49,7 @@ const AddSigner = (props) => {
e.preventDefault();
e.stopPropagation();
setIsLoader(true);
+ if (localStorage.getItem("TenantId")) {
try {
const contactQuery = new Parse.Object("contracts_Contactbook");
contactQuery.set("Name", name);
@@ -56,13 +57,11 @@ const AddSigner = (props) => {
contactQuery.set("Email", email);
contactQuery.set("UserRole", "contracts_Guest");
- if (localStorage.getItem("TenantId")) {
contactQuery.set("TenantId", {
__type: "Pointer",
className: "partners_Tenant",
objectId: localStorage.getItem("TenantId")
});
- }
try {
const _users = Parse.Object.extend("User");
@@ -188,6 +187,9 @@ const AddSigner = (props) => {
setIsLoader(false);
alert("something went wrong!");
}
+ }else{
+ alert('something went wrong, please try again later')
+ }
};
// Define a function to handle the "add yourself" checkbox
diff --git a/apps/OpenSign/src/layout/HomeLayout.js b/apps/OpenSign/src/layout/HomeLayout.js
index 4a40ee111..6198b4e40 100644
--- a/apps/OpenSign/src/layout/HomeLayout.js
+++ b/apps/OpenSign/src/layout/HomeLayout.js
@@ -28,29 +28,34 @@ const HomeLayout = () => {
const [tourConfigs, setTourConfigs] = useState([]);
const [, setCookie] = useCookies(["accesstoken", "main_Domain"]);
+ const tenantId = localStorage.getItem("TenantId");
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) {
- localStorage.setItem("profileImg", user.get("ProfilePic") || "");
- checkIsSubscribed();
- } else {
+ if (!tenantId) {
+ setIsUserValid(false);
+ } else {
+ (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) {
+ localStorage.setItem("profileImg", user.get("ProfilePic") || "");
+ checkIsSubscribed();
+ } else {
+ setIsUserValid(false);
+ }
+ } catch (error) {
+ // Session token is invalid or there was an error
setIsUserValid(false);
}
- } catch (error) {
- // Session token is invalid or there was an error
- setIsUserValid(false);
- }
- })();
- saveCookies();
+ })();
+ saveCookies();
+ }
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
+ }, [tenantId]);
//function to use save data in cookies storage
const saveCookies = () => {
const main_Domain = window.location.origin;
diff --git a/apps/OpenSign/src/pages/Dashboard.js b/apps/OpenSign/src/pages/Dashboard.js
index 3b580d396..7b82b2638 100644
--- a/apps/OpenSign/src/pages/Dashboard.js
+++ b/apps/OpenSign/src/pages/Dashboard.js
@@ -24,7 +24,7 @@ const Dashboard = () => {
getDashboard(localStorage.getItem("PageLanding"));
}
} else {
- navigate("/", { replace: true, state: { from: location } });
+ navigate("/", { replace: true, state: { from: "" } });
}
// eslint-disable-next-line
}, [id]);