@webbio/strapi-plugin-page-builder 0.9.17-authentication → 0.9.18-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbio/strapi-plugin-page-builder",
3
- "version": "0.9.17-authentication",
3
+ "version": "0.9.18-authentication",
4
4
  "description": "This is the description of the plugin.",
5
5
  "scripts": {
6
6
  "develop": "tsc -p tsconfig.server.json -w",
@@ -28,14 +28,8 @@ const txtMail_email_template_text_1 = require("./private-content/mail-template/t
28
28
  const constants_1 = require("../../shared/utils/constants");
29
29
  exports.default = {
30
30
  async sendMail(options) {
31
- const { from, to, subject, text, firstName, lastName, confirmationUrl } = options;
32
- const emailData = (0, txtMail_email_template_text_1.txtEmail)({
33
- email: to,
34
- firstName: firstName,
35
- lastName: lastName,
36
- text: text,
37
- confirmationUrl: confirmationUrl
38
- });
31
+ const { from, to, subject, text, variables } = options;
32
+ const emailData = (0, txtMail_email_template_text_1.txtEmail)(text, variables);
39
33
  try {
40
34
  const client = new AWS.SES();
41
35
  await client.sendEmail({
@@ -68,8 +62,10 @@ exports.default = {
68
62
  subject: foundUser.platform.platformEmails.adminEmail.subject,
69
63
  // @ts-ignore
70
64
  text: foundUser.platform.platformEmails.adminEmail.message,
71
- firstName: user.firstName,
72
- lastName: user.lastName
65
+ variables: {
66
+ firstName: user.firstName,
67
+ lastName: user.lastName
68
+ }
73
69
  });
74
70
  },
75
71
  async sendConfirmationEmail(user) {
@@ -86,7 +82,7 @@ exports.default = {
86
82
  data: { confirmationToken: confirmationToken }
87
83
  });
88
84
  // @ts-ignore
89
- const activateUrl = `${strapi.config.server.url}/api/page-builder/activate/${confirmationToken}`;
85
+ const confirmEmailUrl = `${strapi.config.server.url}/api/page-builder/activate/${confirmationToken}`;
90
86
  await this.sendMail({
91
87
  // @ts-ignore
92
88
  from: foundUser.platform.platformEmails.accountCreatedMail.fromEmail,
@@ -95,9 +91,11 @@ exports.default = {
95
91
  subject: foundUser.platform.platformEmails.accountCreatedMail.subject,
96
92
  // @ts-ignore
97
93
  text: foundUser.platform.platformEmails.accountCreatedMail.message,
98
- firstName: user.firstName,
99
- lastName: user.lastName,
100
- confirmationUrl: activateUrl
94
+ variables: {
95
+ firstName: user.firstName,
96
+ lastName: user.lastName,
97
+ confirmEmailUrl
98
+ }
101
99
  });
102
100
  }
103
101
  },
@@ -109,8 +107,9 @@ exports.default = {
109
107
  // @ts-ignore
110
108
  data: { resetPasswordToken }
111
109
  });
112
- // @ts-ignore
113
- const activateUrl = `${user.platform.domain}/api/page-builder/reset/${resetPasswordToken}`;
110
+ // @ts-ignore // TODO: remove hardcoded path
111
+ const searchParams = new URLSearchParams({ token: resetPasswordToken });
112
+ const resetPasswordUrl = `${user.platform.domain}/ketenafspraken/reset-password/?${searchParams.toString()}`;
114
113
  await this.sendMail({
115
114
  // @ts-ignore
116
115
  from: user.platform.platformEmails.resetPasswordMail.fromEmail,
@@ -119,9 +118,11 @@ exports.default = {
119
118
  subject: user.platform.platformEmails.resetPasswordMail.subject,
120
119
  // @ts-ignore
121
120
  text: user.platform.platformEmails.resetPasswordMail.message,
122
- firstName: user.firstName,
123
- lastName: user.lastName,
124
- confirmationUrl: activateUrl
121
+ variables: {
122
+ firstName: user.firstName,
123
+ lastName: user.lastName,
124
+ resetPasswordUrl
125
+ }
125
126
  });
126
127
  }
127
128
  }
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.txtEmail = void 0;
7
7
  const handlebars_1 = __importDefault(require("handlebars"));
8
- const txtEmail = (mailData) => {
9
- const template = handlebars_1.default.compile(mailData.text);
10
- return template(mailData);
8
+ const txtEmail = (text, variables) => {
9
+ const template = handlebars_1.default.compile(text);
10
+ return template(variables);
11
11
  };
12
12
  exports.txtEmail = txtEmail;