notherbase-fs 3.2.0 → 3.2.2

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.
@@ -44,13 +44,12 @@ export default class User {
44
44
  if (spirit) {
45
45
  let token = Math.floor(Math.random() * 9999);
46
46
 
47
- if (req.body.test) console.log("token: " + token);
48
-
49
47
  spirit.memory.data.resetToken = token;
50
48
  spirit.memory.data.resetExp = Date.now() + (1000 * 60 * 10);
51
49
  await spirit.commit();
52
50
 
53
- req.db.SendMail.passwordReset(req.body.email, token);
51
+ if (req.body.test) console.log("token: " + token);
52
+ else req.db.SendMail.passwordReset(req.body.email, token);
54
53
 
55
54
  success(res, "Password reset token sent.");
56
55
  }
@@ -6,24 +6,10 @@ import nodemailer from "nodemailer";
6
6
  * @param {Number} resetToken Token to reset by.
7
7
  */
8
8
  const passwordReset = async (toEmail, resetToken) => {
9
- var transporter = nodemailer.createTransport({
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',
10
+ `<h1>Your One-Time Password Reset Code:<h1>
11
+ <h2>${resetToken}<h2>
12
+ <p>Visit <a href="https://www.notherbase.com/the-front/keeper">notherbase.com/the-front/keeper</a> to finish changing your password.</p>`);
27
13
  };
28
14
 
29
15
  /**
@@ -34,14 +20,14 @@ const passwordReset = async (toEmail, resetToken) => {
34
20
  * @returns
35
21
  */
36
22
  const send = async (toEmail, subject, html) => {
37
- var transporter = nodemailer.createTransport({
23
+ const transporter = nodemailer.createTransport({
38
24
  service: 'gmail',
39
25
  auth: {
40
26
  user: process.env.NOREPLY,
41
- pass: process.env.NOREPLYPW
27
+ pass: process.env.EMAILPW
42
28
  }
43
- });
44
-
29
+ });
30
+
45
31
  var mailOptions = {
46
32
  from: process.env.NOREPLY,
47
33
  to: toEmail,
@@ -49,9 +35,11 @@ const send = async (toEmail, subject, html) => {
49
35
  html: html
50
36
  };
51
37
 
52
- return await transporter.sendMail(mailOptions, function(error, info){
38
+ let sent = await transporter.sendMail(mailOptions, function(error, info){
53
39
  if (error) console.log(error);
54
40
  });
41
+
42
+ return sent;
55
43
  }
56
44
 
57
45
  export default { passwordReset, send };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  <input type="email" placeholder="user@email.com" id="email">
26
26
  <input type="password" placeholder="password" id="pass">
27
27
  <button id="login" onclick="coverLogin()">Login</button>
28
- <button id="reset" onclick="coverReset()">Reset Password</button>
28
+ <a href="/the-front/keeper">Reset Password</a>
29
29
  <p class="info"></p>
30
30
 
31
31
  <script>
@@ -38,14 +38,6 @@
38
38
  if (response.status === "success") location.reload();
39
39
  $(".login-cover .info").text(response.data);
40
40
  };
41
-
42
- const coverReset = async () => {
43
- let response = await base.resetPassword(
44
- $(".login-cover #email").val()
45
- );
46
-
47
- $(".login-cover .info").text(response.data);
48
- };
49
41
  </script>
50
42
  </div>
51
43
  <% } else { %>
File without changes
File without changes