passwordRequest.js 864 B

1234567891011121314151617181920212223242526272829
  1. import mail from "../index";
  2. /**
  3. * Sends a request password email
  4. *
  5. * @param {string} to - the email address of the recipient
  6. * @param {string} username - the username of the recipient
  7. * @param {string} code - the password code of the recipient
  8. * @param {Function} cb - gets called when an error occurred or when the operation was successful
  9. */
  10. export default (to, username, code, cb) => {
  11. const data = {
  12. to,
  13. subject: "Password request",
  14. html: `
  15. Hello there ${username},
  16. <br>
  17. <br>
  18. Someone has requested to add a password to your account. If this was not you, you can ignore this email.
  19. <br>
  20. <br>
  21. The code is <b>${code}</b>. You can enter this code on the page you requested the password on. This code will expire in 24 hours.
  22. `
  23. };
  24. mail.runJob("SEND_MAIL", { data })
  25. .then(() => cb())
  26. .catch(err => cb(err));
  27. };