@openinc/parse-server-opendash 4.2.3 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/config/helper/customOptions.js +1 -1
- package/dist/features/notifications/services/initEmailTransport.js +3 -1
- package/dist/features/notifications/services/sendMails.js +2 -2
- package/dist/features/notifications/states/EmailState.d.ts +6 -0
- package/dist/features/notifications/states/EmailState.js +16 -0
- package/dist/templates/emails/openinc-auth-password-reset.html +61 -0
- package/dist/templates/emails/openinc-auth-password-reset.subject +1 -0
- package/dist/templates/emails/openinc-auth-password-reset.txt +27 -0
- package/package.json +2 -2
|
@@ -266,7 +266,7 @@ exports.customoptions = {
|
|
|
266
266
|
required: false,
|
|
267
267
|
secret: false,
|
|
268
268
|
public: false,
|
|
269
|
-
description: "The directory where the email templates are stored. The default is 'views/emails'.",
|
|
269
|
+
description: "The directory where the email templates are stored. The default is 'views/emails'. Templates placed here override the ones shipped with this package; if neither provides a template, the fallback text of the sending code is used.",
|
|
270
270
|
default: "views/emails",
|
|
271
271
|
},
|
|
272
272
|
SMTP_ENABLED: {
|
|
@@ -36,7 +36,9 @@ async function initEmailTransport() {
|
|
|
36
36
|
emailState.setTransport(transport);
|
|
37
37
|
const templateDir = (0, path_1.resolve)(process.cwd(), index_js_1.ConfigInstance.getInstance().get("EMAIL_TEMPLATE_DIR"));
|
|
38
38
|
emailState.setEmailTemplateDir(templateDir);
|
|
39
|
-
nunjucks_1.default.configure(
|
|
39
|
+
nunjucks_1.default.configure(emailState.getEmailTemplateDirs(), {
|
|
40
|
+
autoescape: true,
|
|
41
|
+
});
|
|
40
42
|
console.log("[@openinc/parse-server-opendash] Email transport initialized successfully");
|
|
41
43
|
}
|
|
42
44
|
else {
|
|
@@ -71,9 +71,9 @@ function validateEmailTemplate(templateDir, template) {
|
|
|
71
71
|
*/
|
|
72
72
|
function renderEmailTemplate(type, template, data, fallback) {
|
|
73
73
|
const emailState = EmailState_js_1.EmailState.getInstance();
|
|
74
|
-
const
|
|
74
|
+
const emailTemplateDirs = emailState.getEmailTemplateDirs();
|
|
75
75
|
const fullTemplate = template + "." + type;
|
|
76
|
-
if (validateEmailTemplate(
|
|
76
|
+
if (emailTemplateDirs.some((dir) => validateEmailTemplate(dir, fullTemplate))) {
|
|
77
77
|
return nunjucks_1.default.render(fullTemplate, data);
|
|
78
78
|
}
|
|
79
79
|
if (type === "html") {
|
|
@@ -28,6 +28,12 @@ export declare class EmailState {
|
|
|
28
28
|
* Get the email template directory
|
|
29
29
|
*/
|
|
30
30
|
getEmailTemplateDir(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get all directories a template is searched in, in order of precedence:
|
|
33
|
+
* the deployment specific directory first, the templates shipped with this
|
|
34
|
+
* package second.
|
|
35
|
+
*/
|
|
36
|
+
getEmailTemplateDirs(): string[];
|
|
31
37
|
/**
|
|
32
38
|
* Check if email transport is configured and ready
|
|
33
39
|
*/
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailState = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
/**
|
|
6
|
+
* Email templates shipped with this package. They are used whenever the
|
|
7
|
+
* deployment specific template directory does not provide a template of the
|
|
8
|
+
* same name. Resolved relative to this file, so it works both for the compiled
|
|
9
|
+
* output (dist/templates/emails) and for the sources (src/templates/emails).
|
|
10
|
+
*/
|
|
11
|
+
const BUILTIN_EMAIL_TEMPLATE_DIR = (0, path_1.resolve)(__dirname, "../../../templates/emails");
|
|
4
12
|
/**
|
|
5
13
|
* Singleton class to manage email transport and template directory
|
|
6
14
|
*/
|
|
@@ -42,6 +50,14 @@ class EmailState {
|
|
|
42
50
|
getEmailTemplateDir() {
|
|
43
51
|
return this.emailTemplateDir;
|
|
44
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Get all directories a template is searched in, in order of precedence:
|
|
55
|
+
* the deployment specific directory first, the templates shipped with this
|
|
56
|
+
* package second.
|
|
57
|
+
*/
|
|
58
|
+
getEmailTemplateDirs() {
|
|
59
|
+
return [this.emailTemplateDir, BUILTIN_EMAIL_TEMPLATE_DIR];
|
|
60
|
+
}
|
|
45
61
|
/**
|
|
46
62
|
* Check if email transport is configured and ready
|
|
47
63
|
*/
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f4f5f7;padding:32px 12px;font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;">
|
|
2
|
+
<tr>
|
|
3
|
+
<td align="center">
|
|
4
|
+
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="max-width:600px;width:100%;background:#ffffff;border-radius:8px;border:1px solid #e3e5e8;">
|
|
5
|
+
<tr>
|
|
6
|
+
<td style="padding:32px 40px 8px 40px;">
|
|
7
|
+
<h1 style="margin:0 0 16px 0;font-size:20px;line-height:28px;color:#1a1d21;font-weight:600;">Passwort zurücksetzen</h1>
|
|
8
|
+
<p style="margin:0 0 16px 0;font-size:15px;line-height:23px;color:#40454c;">
|
|
9
|
+
Hallo,<br>
|
|
10
|
+
du hast angefordert, dein Passwort zurückzusetzen. Klicke dazu auf den folgenden Button:
|
|
11
|
+
</p>
|
|
12
|
+
</td>
|
|
13
|
+
</tr>
|
|
14
|
+
<tr>
|
|
15
|
+
<td align="center" style="padding:8px 40px 24px 40px;">
|
|
16
|
+
<table role="presentation" cellpadding="0" cellspacing="0" border="0">
|
|
17
|
+
<tr>
|
|
18
|
+
<td bgcolor="#2563eb" style="border-radius:6px;">
|
|
19
|
+
<a href="{{ link }}" style="display:inline-block;padding:13px 28px;font-size:15px;font-weight:600;color:#ffffff;text-decoration:none;border-radius:6px;">Passwort zurücksetzen</a>
|
|
20
|
+
</td>
|
|
21
|
+
</tr>
|
|
22
|
+
</table>
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<tr>
|
|
26
|
+
<td style="padding:0 40px 24px 40px;">
|
|
27
|
+
<p style="margin:0 0 8px 0;font-size:13px;line-height:20px;color:#6b7280;">
|
|
28
|
+
Falls der Button nicht funktioniert, kopiere diesen Link in deinen Browser:
|
|
29
|
+
</p>
|
|
30
|
+
<p style="margin:0;font-size:12px;line-height:18px;word-break:break-all;">
|
|
31
|
+
<a href="{{ link }}" style="color:#2563eb;">{{ link }}</a>
|
|
32
|
+
</p>
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td style="padding:0 40px;">
|
|
37
|
+
<p style="margin:0 0 24px 0;font-size:13px;line-height:20px;color:#6b7280;">
|
|
38
|
+
Der Link ist nur einmal verwendbar. Hast du diese Anfrage nicht gestellt, ignoriere diese E-Mail – dein Passwort bleibt unverändert.
|
|
39
|
+
</p>
|
|
40
|
+
<hr style="border:0;border-top:1px solid #e3e5e8;margin:0 0 24px 0;">
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td style="padding:0 40px 32px 40px;">
|
|
45
|
+
<h2 style="margin:0 0 12px 0;font-size:16px;line-height:24px;color:#1a1d21;font-weight:600;">Reset your password</h2>
|
|
46
|
+
<p style="margin:0 0 12px 0;font-size:14px;line-height:22px;color:#40454c;">
|
|
47
|
+
Hello,<br>
|
|
48
|
+
you requested to reset your password. Use the button above, or open this link:
|
|
49
|
+
</p>
|
|
50
|
+
<p style="margin:0 0 12px 0;font-size:12px;line-height:18px;word-break:break-all;">
|
|
51
|
+
<a href="{{ link }}" style="color:#2563eb;">{{ link }}</a>
|
|
52
|
+
</p>
|
|
53
|
+
<p style="margin:0;font-size:13px;line-height:20px;color:#6b7280;">
|
|
54
|
+
The link can only be used once. If you did not request this, simply ignore this email – your password remains unchanged.
|
|
55
|
+
</p>
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
</table>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Passwort zurücksetzen / Reset your password
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
PASSWORT ZURÜCKSETZEN
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Hallo,
|
|
5
|
+
|
|
6
|
+
du hast angefordert, dein Passwort zurückzusetzen. Öffne dazu den
|
|
7
|
+
folgenden Link:
|
|
8
|
+
|
|
9
|
+
{{ link | safe }}
|
|
10
|
+
|
|
11
|
+
Der Link ist nur einmal verwendbar. Falls du diese Anfrage nicht
|
|
12
|
+
gestellt hast, kannst du diese E-Mail ignorieren – dein Passwort
|
|
13
|
+
bleibt unverändert.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
RESET YOUR PASSWORD
|
|
17
|
+
===================
|
|
18
|
+
|
|
19
|
+
Hello,
|
|
20
|
+
|
|
21
|
+
you requested to reset your password. Please open the following
|
|
22
|
+
link:
|
|
23
|
+
|
|
24
|
+
{{ link | safe }}
|
|
25
|
+
|
|
26
|
+
The link can only be used once. If you did not request this, simply
|
|
27
|
+
ignore this email – your password remains unchanged.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openinc/parse-server-opendash",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Parse Server Cloud Code for open.INC Stack.",
|
|
5
5
|
"packageManager": "pnpm@11.25.0",
|
|
6
6
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"start": "tsc -w",
|
|
53
53
|
"dockerstart": "concurrently \"pnpm run start\" \"cd ./docker-dev && docker-compose watch\"",
|
|
54
|
-
"build": "rimraf ./dist && tsc && node scripts/copyTranslationFiles.js",
|
|
54
|
+
"build": "rimraf ./dist && tsc && node scripts/copyTranslationFiles.js && node scripts/copyEmailTemplates.js",
|
|
55
55
|
"copy:i18n": "node scripts/copyTranslationFiles.js",
|
|
56
56
|
"deploy": "opendash deploy",
|
|
57
57
|
"schema-down": "parse-server-schema down --prefix OD3_ ./schema",
|