resetPasswordRequest.js 892 B

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