resetPasswordRequest.js 987 B

1234567891011121314151617181920212223242526272829303132
  1. // const moduleManager = require('../../../index');
  2. import mail from "../index";
  3. /**
  4. * Sends a request password reset email
  5. *
  6. * @param {string} to - the email address of the recipient
  7. * @param {string} username - the username of the recipient
  8. * @param {string} code - the password reset code of the recipient
  9. * @param {Function} cb - gets called when an error occurred or when the operation was successful
  10. */
  11. export default (to, username, code, cb) => {
  12. const data = {
  13. from: "Musare <noreply@musare.com>",
  14. to,
  15. subject: "Password reset request",
  16. html: `
  17. Hello there ${username},
  18. <br>
  19. <br>
  20. Someone has requested to reset the password of your account. If this was not you, you can ignore this email.
  21. <br>
  22. <br>
  23. 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.
  24. `
  25. };
  26. mail.runJob("SEND_MAIL", { data })
  27. .then(() => cb())
  28. .catch(err => cb(err));
  29. };