Skip to content

Commit 5050b9e

Browse files
Merge pull request #991 from OpenSignLabs/multiuser_issue
2 parents 9619eec + 23da4be commit 5050b9e

32 files changed

+101
-52
lines changed

apps/OpenSign/src/primitives/ValidateRoute.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@ const ValidateRoute = () => {
2020
})();
2121
}, []);
2222
const handlelogout = async () => {
23-
try {
24-
// if (Parse?.User?.current()) {
25-
// Parse?.User?.logOut();
26-
// }
27-
localStorage.removeItem("accesstoken");
28-
} catch (err) {
29-
console.log("err ", err);
30-
localStorage.removeItem("accesstoken");
31-
}
23+
let appdata = localStorage.getItem("userSettings");
24+
let applogo = localStorage.getItem("appLogo");
25+
let defaultmenuid = localStorage.getItem("defaultmenuid");
26+
let PageLanding = localStorage.getItem("PageLanding");
27+
let baseUrl = localStorage.getItem("baseUrl");
28+
let appid = localStorage.getItem("parseAppId");
29+
30+
localStorage.clear();
31+
32+
localStorage.setItem("appLogo", applogo);
33+
localStorage.setItem("defaultmenuid", defaultmenuid);
34+
localStorage.setItem("PageLanding", PageLanding);
35+
localStorage.setItem("userSettings", appdata);
36+
localStorage.setItem("baseUrl", baseUrl);
37+
localStorage.setItem("parseAppId", appid);
3238
};
3339
return <div>{<Outlet />}</div>;
3440
};

apps/OpenSignServer/Utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ dotenv.config();
44

55
const appId = process.env.APP_ID;
66
const serverUrl = process.env.SERVER_URL;
7+
export const cloudServerUrl = 'http://localhost:8080/app';
78
export function customAPIurl() {
8-
const url = new URL(process.env.SERVER_URL);
9+
const url = new URL(cloudServerUrl);
910
return url.pathname === '/api/app' ? url.origin + '/api' : url.origin;
1011
}
1112

apps/OpenSignServer/cloud/customRoute/autoReminder.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axios from 'axios';
2+
import { cloudServerUrl } from '../../Utils.js';
23

34
// `replaceMailVaribles` is used to replace variables from mail with there actual values
45
function replaceMailVaribles(subject, body, variables) {
@@ -26,7 +27,7 @@ function replaceMailVaribles(subject, body, variables) {
2627
async function sendMail(doc, signer) {
2728
const subject = `{{sender_name}} has requested you to sign "{{document_title}}"`;
2829
const body = `<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}}&nbsp;has requested you to review and sign&nbsp;<b>"{{document_title}}"</b>.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p>{{signing_url}}</p><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team OpenSign™</p><br></body> </html>`;
29-
const url = `${process.env.SERVER_URL}/functions/sendmailv3`;
30+
const url = `${cloudServerUrl}/functions/sendmailv3`;
3031
const headers = {
3132
'Content-Type': 'application/json',
3233
'X-Parse-Application-Id': process.env.APP_ID,

apps/OpenSignServer/cloud/customRoute/googleauth.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import axios from 'axios';
2+
import { cloudServerUrl } from '../../Utils.js';
23
const appId = process.env.APP_ID;
3-
const serverUrl = process.env.SERVER_URL;
4+
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
45
export default async function gooogleauth(request, response) {
56
const code = request.body.code;
67
const baseUrl = new URL(process.env.SERVER_URL);

apps/OpenSignServer/cloud/customRoute/uploadFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import multer from 'multer';
33
import multerS3 from 'multer-s3';
44
import aws from 'aws-sdk';
55
import dotenv from 'dotenv';
6-
import { useLocal } from '../../Utils.js';
6+
import { cloudServerUrl, useLocal } from '../../Utils.js';
77
dotenv.config();
88

99
function sanitizeFileName(fileName) {
@@ -49,7 +49,7 @@ async function uploadFile(req, res) {
4949
const DO_SECRET_ACCESS_KEY = process.env.DO_SECRET_ACCESS_KEY;
5050
const DO_SPACE = process.env.DO_SPACE;
5151

52-
const parseBaseUrl = process.env.SERVER_URL;
52+
const parseBaseUrl = cloudServerUrl; //process.env.SERVER_URL;
5353
const parseAppId = process.env.APP_ID;
5454
let fileStorage;
5555
if (useLocal === 'true') {

apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { customAPIurl, replaceMailVaribles } from '../../../../Utils.js';
2+
import { cloudServerUrl, customAPIurl, replaceMailVaribles } from '../../../../Utils.js';
33

44
// `sendDoctoWebhook` is used to send res data of document on webhook
55
async function sendDoctoWebhook(doc, WebhookUrl, userId) {
@@ -220,7 +220,7 @@ export default async function createDocumentWithTemplate(request, response) {
220220
for (let i = 0; i < contactMail.length; i++) {
221221
try {
222222
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
223-
let url = `${process.env.SERVER_URL}/functions/sendmailv3/`;
223+
let url = `${cloudServerUrl}/functions/sendmailv3/`;
224224
const headers = {
225225
'Content-Type': 'application/json',
226226
'X-Parse-Application-Id': process.env.APP_ID,

apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
saveFileUsage,
77
formatWidgetOptions,
88
sanitizeFileName,
9+
cloudServerUrl,
910
} from '../../../../Utils.js';
1011

1112
// `sendDoctoWebhook` is used to send res data of document on webhook
@@ -281,7 +282,7 @@ export default async function createDocumentwithCoordinate(request, response) {
281282
for (let i = 0; i < contactMail.length; i++) {
282283
try {
283284
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
284-
let url = `${process.env.SERVER_URL}/functions/sendmailv3/`;
285+
let url = `${cloudServerUrl}/functions/sendmailv3/`;
285286
const headers = {
286287
'Content-Type': 'application/json',
287288
'X-Parse-Application-Id': process.env.APP_ID,

apps/OpenSignServer/cloud/customRoute/v1/routes/getDocumentList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import axios from 'axios';
22
import reportJson from '../../../parsefunction/reportsJson.js';
33
import dotenv from 'dotenv';
4+
import { cloudServerUrl } from '../../../../Utils.js';
45
dotenv.config();
56

67
export default async function getDocumentList(request, response) {
78
const reqToken = request.headers['x-api-token'];
89
const appId = process.env.APP_ID;
9-
const serverUrl = process.env.SERVER_URL;
10+
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
1011
if (!reqToken) {
1112
return response.status(400).json({ error: 'Please Provide API Token' });
1213
}

apps/OpenSignServer/cloud/customRoute/v1/routes/getTemplateList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import axios from 'axios';
22
import dotenv from 'dotenv';
3+
import { cloudServerUrl } from '../../../../Utils.js';
34
dotenv.config();
45
export default async function getTemplatetList(request, response) {
56
const reqToken = request.headers['x-api-token'];
67
const appId = process.env.APP_ID;
7-
const serverUrl = process.env.SERVER_URL;
8+
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
89
if (!reqToken) {
910
return response.status(400).json({ error: 'Please Provide API Token' });
1011
}

apps/OpenSignServer/cloud/customRoute/v1/routes/resendMail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { replaceMailVaribles } from '../../../../Utils.js';
2+
import { cloudServerUrl, replaceMailVaribles } from '../../../../Utils.js';
33

44
export default async function resendMail(request, response) {
55
try {
@@ -44,7 +44,7 @@ export default async function resendMail(request, response) {
4444
if (contact) {
4545
try {
4646
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
47-
let url = `${process.env.SERVER_URL}/functions/sendmailv3/`;
47+
let url = `${cloudServerUrl}/functions/sendmailv3/`;
4848
const headers = {
4949
'Content-Type': 'application/json',
5050
'X-Parse-Application-Id': process.env.APP_ID,

0 commit comments

Comments
 (0)