@webbio/strapi-plugin-page-builder 0.9.17-authentication → 0.9.19-authentication
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/package.json +1 -1
- package/dist/server/services/email.js +19 -18
- package/dist/server/services/private-content/mail-template/txtMail.email.template.text.js +3 -3
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/server/services/email.ts +21 -21
- package/server/services/private-content/mail-template/txtMail.email.template.text.ts +3 -4
package/package.json
CHANGED
package/server/services/email.ts
CHANGED
|
@@ -7,21 +7,14 @@ interface SendOptions {
|
|
|
7
7
|
to: string;
|
|
8
8
|
subject: string;
|
|
9
9
|
text: string;
|
|
10
|
-
|
|
11
|
-
lastName: string;
|
|
12
|
-
confirmationUrl?: string;
|
|
10
|
+
variables?: Record<string, string>;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export default {
|
|
16
14
|
async sendMail(options: SendOptions) {
|
|
17
|
-
const { from, to, subject, text,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
firstName: firstName,
|
|
21
|
-
lastName: lastName,
|
|
22
|
-
text: text,
|
|
23
|
-
confirmationUrl: confirmationUrl
|
|
24
|
-
});
|
|
15
|
+
const { from, to, subject, text, variables } = options;
|
|
16
|
+
|
|
17
|
+
const emailData = txtEmail(text, variables);
|
|
25
18
|
|
|
26
19
|
try {
|
|
27
20
|
const client = new AWS.SES();
|
|
@@ -54,8 +47,10 @@ export default {
|
|
|
54
47
|
subject: foundUser.platform.platformEmails.adminEmail.subject,
|
|
55
48
|
// @ts-ignore
|
|
56
49
|
text: foundUser.platform.platformEmails.adminEmail.message,
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
variables: {
|
|
51
|
+
firstName: user.firstName,
|
|
52
|
+
lastName: user.lastName
|
|
53
|
+
}
|
|
59
54
|
});
|
|
60
55
|
},
|
|
61
56
|
async sendConfirmationEmail(user) {
|
|
@@ -75,7 +70,7 @@ export default {
|
|
|
75
70
|
});
|
|
76
71
|
|
|
77
72
|
// @ts-ignore
|
|
78
|
-
const
|
|
73
|
+
const confirmEmailUrl = `${strapi.config.server.url}/api/page-builder/activate/${confirmationToken}`;
|
|
79
74
|
|
|
80
75
|
await this.sendMail({
|
|
81
76
|
// @ts-ignore
|
|
@@ -85,9 +80,11 @@ export default {
|
|
|
85
80
|
subject: foundUser.platform.platformEmails.accountCreatedMail.subject,
|
|
86
81
|
// @ts-ignore
|
|
87
82
|
text: foundUser.platform.platformEmails.accountCreatedMail.message,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
variables: {
|
|
84
|
+
firstName: user.firstName,
|
|
85
|
+
lastName: user.lastName,
|
|
86
|
+
confirmEmailUrl
|
|
87
|
+
}
|
|
91
88
|
});
|
|
92
89
|
}
|
|
93
90
|
},
|
|
@@ -105,7 +102,8 @@ export default {
|
|
|
105
102
|
});
|
|
106
103
|
|
|
107
104
|
// @ts-ignore
|
|
108
|
-
const
|
|
105
|
+
const searchParams = new URLSearchParams({ token: resetPasswordToken });
|
|
106
|
+
const resetPasswordUrl = `${user.platform.domain}/reset-password/?${searchParams.toString()}`;
|
|
109
107
|
|
|
110
108
|
await this.sendMail({
|
|
111
109
|
// @ts-ignore
|
|
@@ -115,9 +113,11 @@ export default {
|
|
|
115
113
|
subject: user.platform.platformEmails.resetPasswordMail.subject,
|
|
116
114
|
// @ts-ignore
|
|
117
115
|
text: user.platform.platformEmails.resetPasswordMail.message,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
variables: {
|
|
117
|
+
firstName: user.firstName,
|
|
118
|
+
lastName: user.lastName,
|
|
119
|
+
resetPasswordUrl
|
|
120
|
+
}
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Handlebars from 'handlebars';
|
|
2
|
-
import { IMail } from './txtMail.interface';
|
|
3
2
|
|
|
4
|
-
export const txtEmail = (
|
|
5
|
-
const template = Handlebars.compile(
|
|
6
|
-
return template(
|
|
3
|
+
export const txtEmail = (text: string, variables?: Record<string, string>) => {
|
|
4
|
+
const template = Handlebars.compile(text);
|
|
5
|
+
return template(variables);
|
|
7
6
|
};
|