Skip to content

Commit 6ea254d

Browse files
fix: show proper error if server down in self-hosting
1 parent a4d1df8 commit 6ea254d

File tree

10 files changed

+111
-88
lines changed

10 files changed

+111
-88
lines changed

apps/OpenSign/public/locales/en/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@
668668
"download-files":"Download files",
669669
"download-pdf":"Download Pdf",
670670
"pdf-certificate":"Download Pdf + Certificate",
671-
"document-logs":"Document logs"
671+
"document-logs":"Document logs",
672+
"server-down": "Unable to connect to the OpenSign server. If you are self-hosting OpenSign, please ensure that all the steps in the documentation have been followed correctly. If you're running OpenSign locally, you might be accessing it through an incorrect port number.",
673+
"admin-exists": "Admin already exists. Please login to the application using admin credentials in order to manage users."
672674

673675
}

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@
667667
"download-files" :"Télécharger des fichiers",
668668
"download-pdf" :"Télécharger le PDF",
669669
"pdf-certificate" :"Télécharger Pdf + Certificat",
670-
"document-logs":"Journaux de documents"
670+
"document-logs":"Journaux de documents",
671+
"server-down": "Impossible de se connecter au serveur OpenSign. Si vous hébergez vous-même OpenSign, veuillez vous assurer que toutes les étapes de la documentation ont été correctement suivies. Si vous exécutez OpenSign localement, vous y accédez peut-être via un numéro de port incorrect.",
672+
"admin-exists": "L'administrateur existe déjà. Veuillez vous connecter à l'application en utilisant les informations d'identification de l'administrateur afin de gérer les utilisateurs."
673+
671674

672675
}

apps/OpenSign/public/version.txt

0 Bytes
Binary file not shown.

apps/OpenSign/src/constant/Utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,11 @@ export const getAppLogo = async () => {
19261926
}
19271927
} catch (err) {
19281928
console.log("err in getlogo ", err);
1929-
return { logo: appInfo.applogo, user: "exist" };
1929+
if (err?.includes("is not valid JSON")) {
1930+
return { logo: appInfo.applogo, user: "exist", error: "invalid_json" };
1931+
} else {
1932+
return { logo: appInfo.applogo, user: "exist" };
1933+
}
19301934
}
19311935
}
19321936
};

apps/OpenSign/src/pages/AddAdmin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const AddAdmin = () => {
4646
try {
4747
const app = await getAppLogo();
4848
if (app?.user === "exist") {
49-
setErrMsg(t("admin-already-exist"));
49+
setErrMsg(t("admin-exists"));
5050
}
5151
} catch (err) {
5252
setErrMsg(t("something-went-wrong-mssg"));

apps/OpenSign/src/pages/Login.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function Login() {
5151
const [isModal, setIsModal] = useState(false);
5252
const [image, setImage] = useState();
5353
const [isLoginSSO, setIsLoginSSO] = useState(false);
54+
const [errMsg, setErrMsg] = useState();
5455

5556
useEffect(() => {
5657
checkUserExt();
@@ -59,7 +60,9 @@ function Login() {
5960

6061
const checkUserExt = async () => {
6162
const app = await getAppLogo();
62-
if (!isEnableSubscription && app?.user === "not_exist") {
63+
if (app?.error === "invalid_json") {
64+
setErrMsg(t("server-down"));
65+
} else if (!isEnableSubscription && app?.user === "not_exist") {
6366
navigate("/addadmin");
6467
}
6568
if (app?.logo) {
@@ -620,7 +623,11 @@ function Login() {
620623
}
621624
};
622625

623-
return (
626+
return errMsg ? (
627+
<div className="h-screen flex justify-center text-center items-center p-4 text-gray-500 text-base">
628+
{errMsg}
629+
</div>
630+
) : (
624631
<div>
625632
<Title title={"Login Page"} />
626633
{state.loading && (

apps/OpenSign/src/pages/UpdateExistUserAdmin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const UpdateExistUserAdmin = () => {
5252
} else if (err.code === 101) {
5353
setIsAlert((prev) => ({ ...prev, msg: t("user-not-found") }));
5454
} else if (err.code === 137) {
55-
setIsAlert((prev) => ({ ...prev, msg: t("admin-already-exist") }));
55+
setIsAlert((prev) => ({ ...prev, msg: t("admin-exists") }));
5656
} else {
5757
setErrMsg(t("something-went-wrong-mssg"));
5858
}

apps/OpenSign/src/script/locales/en/translation.json

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"upgrade-now": "Upgrade now",
4242
"upgrade-to": "Upgrade to",
4343
"plan": "Plan",
44-
"subscribe-card-teamplan":"Unlock the full power of collaboration! Create unlimited organizations, teams, and hierarchies. Share templates seamlessly across teams and assign custom user roles. Elevate your workflow today!",
44+
"subscribe-card-teamplan": "Unlock the full power of collaboration! Create unlimited organizations, teams, and hierarchies. Share templates seamlessly across teams and assign custom user roles. Elevate your workflow today!",
4545
"subscribe-card-plan": "Unlock premium features starting at just {{premiumPrice}}/month. Enjoy enhanced performance and only {{addonPrice}} per additional credit after your included premium credits.",
4646
"user-name-limit-char": "To have a username less than 8 character please subscribe",
4747
"tour-content": "Don't show this again",
@@ -132,7 +132,7 @@
132132
"View": "View",
133133
"option": "Option",
134134
"Embed": "Embed",
135-
"Copy TemplateId":"Copy TemplateId"
135+
"Copy TemplateId": "Copy TemplateId"
136136
},
137137
"report-heading": {
138138
"Sr.No": "Sr.No",
@@ -266,7 +266,7 @@
266266
"public-role": "Public role",
267267
"public-url": "Public URL",
268268
"public-url-copy": "Here’s your public URL: ",
269-
"public-url-copy-mssg":"Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
269+
"public-url-copy-mssg": "Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
270270
"add-public-url-alert": "Please add your public URL, and you will be able to make a public template.",
271271
"share-with-alert": "You cannot share a template if any roles already have contacts assigned. Please remove all contact assignments from the roles before sharing the template.",
272272
"share-with": "Share with",
@@ -597,7 +597,7 @@
597597
"Recently sent for signatures": "This is a list of documents you've sent to other parties for signature.",
598598
"Drafts": "This are documents you have started but have not finalized for sending.",
599599
"public-template": "This video demonstrates how to set up your personalized public profile, such as ‘https://opensign.me/your-username’. You’ll also learn how to customize your tagline and make your templates available for public signing."
600-
},
600+
},
601601
"enter-email-plaholder": "Add an email address and hit enter",
602602
"success-email-alert": "Email sent successfully!",
603603
"expired-doc-title": "Expired Document",
@@ -618,55 +618,58 @@
618618
"select-date-format": "Select a date format",
619619
"quantity-of-credits": "Quantity of premium credits",
620620
"remaining-credits": "Premium credits available:",
621-
"remaining-credits-help":"Use premium credits for API document signing, bulk sending, or embedding OpenSign integration on your website. You have {{allowedcredits}} included credits and {{addoncredits}} additional purchased credits remaining.",
621+
"remaining-credits-help": "Use premium credits for API document signing, bulk sending, or embedding OpenSign integration on your website. You have {{allowedcredits}} included credits and {{addoncredits}} additional purchased credits remaining.",
622622
"additional-credits": "Please purchase premium credits",
623623
"quota-err-quicksend": "Quota Reached, You don't have enough credits.",
624624
"buy-credits": "Buy Premium Credits",
625-
"rotate-right":"Rotate right",
626-
"rotate-left":"Rotate left",
627-
"rotate-alert-mssg":"All widgets on this page will be lost. Are you sure you want to proceed?",
628-
"templateid":"Template-Id",
629-
"bulk-send-subcription-alert":"Please upgrade to Professional or Team plan to use bulk send.",
630-
"generate-test-token":"Generate Test Token",
631-
"regenerate-test-token":"Regenerate Test Token",
632-
"help-test-token":"This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
633-
"help-api-token":"This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
634-
"reason":"Reason",
635-
"decline-by":"Declined/revoked by",
625+
"rotate-right": "Rotate right",
626+
"rotate-left": "Rotate left",
627+
"rotate-alert-mssg": "All widgets on this page will be lost. Are you sure you want to proceed?",
628+
"templateid": "Template-Id",
629+
"bulk-send-subcription-alert": "Please upgrade to Professional or Team plan to use bulk send.",
630+
"generate-test-token": "Generate Test Token",
631+
"regenerate-test-token": "Regenerate Test Token",
632+
"help-test-token": "This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
633+
"help-api-token": "This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
634+
"reason": "Reason",
635+
"decline-by": "Declined/revoked by",
636636
"document-declined": "Document declined",
637-
"public-template-mssg-1":"To integrate OpenSign into your React or Next.js project, simply run the following command:",
638-
"public-template-mssg-2" :"Ensure you have npm or yarn set up in your project. If you’re using Yarn, you can replace npm install with yarn add @opensign/react.",
639-
"public-template-mssg-3" :"Need more details or examples?",
637+
"public-template-mssg-1": "To integrate OpenSign into your React or Next.js project, simply run the following command:",
638+
"public-template-mssg-2": "Ensure you have npm or yarn set up in your project. If you’re using Yarn, you can replace npm install with yarn add @opensign/react.",
639+
"public-template-mssg-3": "Need more details or examples?",
640640
"public-template-mssg-4": "Visit the",
641641
"public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.",
642-
"public-template-mssg-6" :"You need to set this template as public before you can utilize this code snippet.",
643-
"copy-code":"COPY",
644-
"copied-code":"COPIED",
645-
"Installation":"Installation",
646-
"Usage" :"Usage",
647-
"insufficient-credits":"Insufficient Signing Credits",
648-
"insufficient-credits-mssg":"The owner of this document currently lacks the necessary OpenSign credits for you to sign. Please reach out to the owner if you require further details.",
642+
"public-template-mssg-6": "You need to set this template as public before you can utilize this code snippet.",
643+
"copy-code": "COPY",
644+
"copied-code": "COPIED",
645+
"Installation": "Installation",
646+
"Usage": "Usage",
647+
"insufficient-credits": "Insufficient Signing Credits",
648+
"insufficient-credits-mssg": "The owner of this document currently lacks the necessary OpenSign credits for you to sign. Please reach out to the owner if you require further details.",
649649
"angular-npm-mssg-1": "To integrate OpenSign into your Angular project, simply run the following command:",
650-
"quota-mail-info-head":"Monthly request signatures email limit",
650+
"quota-mail-info-head": "Monthly request signatures email limit",
651651
"quota-mail-info": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
652652
"quota-mail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
653-
"quota-mail-tip":"Tip: You can still sign <1>unlimited documents</1> by manually sharing the signing request links.",
654-
"quota-mail-head":"Quota Reached",
655-
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
656-
"sent-this-month":"Sent this month",
657-
"available-seats":"Available seats",
658-
"buy-users":"Buy more users",
653+
"quota-mail-tip": "Tip: You can still sign <1>unlimited documents</1> by manually sharing the signing request links.",
654+
"quota-mail-head": "Quota Reached",
655+
"unauthorized-modal": "You don't have permission to perform this action, please contact {{adminEmail}}.",
656+
"sent-this-month": "Sent this month",
657+
"available-seats": "Available seats",
658+
"buy-users": "Buy more users",
659659
"isenable-otp": "Enable OTP verification",
660660
"isenable-otp-help": {
661661
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
662662
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
663663
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",
664664
"p4": "Please choose the option that best suits your document signing requirements."
665665
},
666-
"advanced-options":"Advanced options",
667-
"hide-advanced-options":"Hide Advanced options",
668-
"download-files":"Download files",
669-
"download-pdf":"Download Pdf",
670-
"pdf-certificate":"Download Pdf + Certificate",
671-
"document-logs":"Document logs"
666+
"advanced-options": "Advanced options",
667+
"hide-advanced-options": "Hide Advanced options",
668+
"download-files": "Download files",
669+
"download-pdf": "Download Pdf",
670+
"pdf-certificate": "Download Pdf + Certificate",
671+
"document-logs": "Document logs",
672+
"server-down": "Unable to connect to the OpenSign server. If you are self-hosting OpenSign, please ensure that all the steps in the documentation have been followed correctly. If you're running OpenSign locally, you might be accessing it through an incorrect port number.",
673+
"admin-exists": "Admin already exists. Please login to the application using admin credentials in order to manage users."
674+
672675
}

0 commit comments

Comments
 (0)