resetPasswordRequest.js 934 B

123456789101112131415161718192021222324252627282930
  1. import mail from "../index";
  2. /**
  3. * Sends a request password reset 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 reset 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. from: "Musare <noreply@musare.com>",
  13. to,
  14. subject: "Password reset request",
  15. html: `
  16. Hello there ${username},
  17. <br>
  18. <br>
  19. Someone has requested to reset the password of your account. If this was not you, you can ignore this email.
  20. <br>
  21. <br>
  22. The reset code is <b>${code}</b>. You can enter this code on the page you requested the password reset. This code will expire in 24 hours.
  23. `
  24. };
  25. mail.runJob("SEND_MAIL", { data })
  26. .then(() => cb())
  27. .catch(err => cb(err));
  28. };