Skip to content

Commit 4e64772

Browse files
refactor: provide appName
1 parent 4188cae commit 4e64772

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

apps/OpenSignServer/Utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import dotenv from 'dotenv';
22
dotenv.config();
33

44
export const cloudServerUrl = 'http://localhost:8080/app';
5+
export const appName = process.env.APP_NAME || 'OpenSign™';
56
export function customAPIurl() {
67
const url = new URL(cloudServerUrl);
78
return url.pathname === '/api/app' ? url.origin + '/api' : url.origin;

apps/OpenSignServer/cloud/parsefunction/SendMailOTPv1.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { smtpenable, updateMailCount } from '../../Utils.js';
1+
import { appName, smtpenable, updateMailCount } from '../../Utils.js';
22
async function getDocument(docId) {
33
try {
44
const query = new Parse.Query('contracts_Document');
@@ -28,12 +28,12 @@ async function sendMailOTPv1(request) {
2828
const mailsender = smtpenable ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER;
2929
try {
3030
await Parse.Cloud.sendEmail({
31-
from: 'Opensign™' + ' <' + mailsender + '>',
31+
from: appName + ' <' + mailsender + '>',
3232
recipient: recipient,
33-
subject: 'Your OpenSign™ OTP',
33+
subject: `Your ${appName} OTP`,
3434
text: 'This email is a test.',
3535
html:
36-
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for OpenSign™ verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>" +
36+
`<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for ${appName} verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>` +
3737
code +
3838
'</p></div> </div> </div></body></html>',
3939
});

apps/OpenSignServer/files/verification_email.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<br />
1111
<p><a href="{{{link}}}" style="background-color: lightskyblue; cursor: pointer; border-radius: 5px; padding: 10px; border-style: solid; border-width: 2px; text-decoration: none; font-weight: bolder; color:blue">Verify email</a></p>
1212
<br />
13-
<p><a href="https://www.opensignlabs.com">OpenSign™</a></p>
13+
<p><a href="https://www.opensignlabs.com">{{appName}}</a></p>
1414
</body>
1515

1616
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
OpenSign™ Email Address Verification
1+
{{appName}} Email Address Verification

apps/OpenSignServer/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { exec } from 'child_process';
1717
import { createTransport } from 'nodemailer';
1818
import { app as v1 } from './cloud/customRoute/v1/apiV1.js';
1919
import { PostHog } from 'posthog-node';
20-
import { cloudServerUrl, smtpenable, smtpsecure, useLocal } from './Utils.js';
20+
import { appName, cloudServerUrl, smtpenable, smtpsecure, useLocal } from './Utils.js';
2121
import { SSOAuth } from './auth/authadapter.js';
2222
let fsAdapter;
2323
if (useLocal !== 'true') {
@@ -102,7 +102,7 @@ export const config = {
102102
verifyUserEmails: false,
103103
publicServerURL: process.env.SERVER_URL || cloudServerUrl,
104104
// Your apps name. This will appear in the subject and body of the emails that are sent.
105-
appName: 'Opensign',
105+
appName: appName,
106106
allowClientClassCreation: false,
107107
allowExpiredAuthDataToken: false,
108108
encodeParseObjectInCloudFunction: true,
@@ -112,7 +112,7 @@ export const config = {
112112
module: 'parse-server-api-mail-adapter',
113113
options: {
114114
// The email address from which emails are sent.
115-
sender: 'Opensign™' + ' <' + mailsender + '>',
115+
sender: appName + ' <' + mailsender + '>',
116116
// The email templates.
117117
templates: {
118118
// The template used by Parse Server to send an email for password
@@ -141,12 +141,7 @@ export const config = {
141141
}
142142
: {}),
143143
filesAdapter: fsAdapter,
144-
auth: {
145-
google: {
146-
enabled: true,
147-
},
148-
sso: SSOAuth,
149-
},
144+
auth: { google: { enabled: true }, sso: SSOAuth },
150145
};
151146
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
152147
// If you wish you require them, you can set them as options in the initialization above:

0 commit comments

Comments
 (0)