resetPasswordRequest.js 928 B

123456789101112131415161718192021222324252627282930
  1. const config = require('config');
  2. const mail = require('../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. module.exports = function(to, username, code, cb) {
  12. let data = {
  13. from: 'Musare <noreply@musare.com>',
  14. to: to,
  15. subject: 'Password reset request',
  16. html:
  17. `
  18. Hello there ${username},
  19. <br>
  20. <br>
  21. Someone has requested to reset the password of your account. If this was not you, you can ignore this email.
  22. <br>
  23. <br>
  24. 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.
  25. `
  26. };
  27. mail.sendMail(data, cb);
  28. };