notherbase-fs 3.2.0 → 3.2.1
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/models/send-mail.js +8 -23
- package/package.json +1 -1
package/models/send-mail.js
CHANGED
|
@@ -6,24 +6,7 @@ import nodemailer from "nodemailer";
|
|
|
6
6
|
* @param {Number} resetToken Token to reset by.
|
|
7
7
|
*/
|
|
8
8
|
const passwordReset = async (toEmail, resetToken) => {
|
|
9
|
-
|
|
10
|
-
service: 'gmail',
|
|
11
|
-
auth: {
|
|
12
|
-
user: process.env.NOREPLY,
|
|
13
|
-
pass: process.env.NOREPLYPW
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
var mailOptions = {
|
|
18
|
-
from: process.env.NOREPLY,
|
|
19
|
-
to: toEmail,
|
|
20
|
-
subject: 'Password Reset for NotherBase',
|
|
21
|
-
html: `<h1>Your One-Time Password Reset Code: ${resetToken}<h1>`
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
transporter.sendMail(mailOptions, function(error, info){
|
|
25
|
-
if (error) console.log(error);
|
|
26
|
-
});
|
|
9
|
+
return await send(toEmail, 'Password Reset for NotherBase', `<h1>Your One-Time Password Reset Code: ${resetToken}<h1>`);
|
|
27
10
|
};
|
|
28
11
|
|
|
29
12
|
/**
|
|
@@ -34,14 +17,14 @@ const passwordReset = async (toEmail, resetToken) => {
|
|
|
34
17
|
* @returns
|
|
35
18
|
*/
|
|
36
19
|
const send = async (toEmail, subject, html) => {
|
|
37
|
-
|
|
20
|
+
const transporter = nodemailer.createTransport({
|
|
38
21
|
service: 'gmail',
|
|
39
22
|
auth: {
|
|
40
23
|
user: process.env.NOREPLY,
|
|
41
|
-
pass: process.env.
|
|
24
|
+
pass: process.env.EMAILPW
|
|
42
25
|
}
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
});
|
|
27
|
+
|
|
45
28
|
var mailOptions = {
|
|
46
29
|
from: process.env.NOREPLY,
|
|
47
30
|
to: toEmail,
|
|
@@ -49,9 +32,11 @@ const send = async (toEmail, subject, html) => {
|
|
|
49
32
|
html: html
|
|
50
33
|
};
|
|
51
34
|
|
|
52
|
-
|
|
35
|
+
let sent = await transporter.sendMail(mailOptions, function(error, info){
|
|
53
36
|
if (error) console.log(error);
|
|
54
37
|
});
|
|
38
|
+
|
|
39
|
+
return sent;
|
|
55
40
|
}
|
|
56
41
|
|
|
57
42
|
export default { passwordReset, send };
|