forgot-password.js 643 B

1234567891011121314151617181920212223242526272829
  1. module.exports = function(crowi, app) {
  2. const { appService, mailService } = crowi;
  3. const path = require('path');
  4. const actions = {};
  5. const api = {};
  6. actions.api = api;
  7. actions.forgotPassword = async function(req, res) {
  8. return res.render('forgot-password');
  9. };
  10. async function sendPasswordResetEmail() {
  11. return mailService.send({
  12. to: 'kaori@weseek.co.jp',
  13. subject: 'forgotPasswordMailTest',
  14. template: path.join(crowi.localeDir, 'en_US/notifications/passwordReset.txt'),
  15. });
  16. }
  17. api.get = async function(req, res) {
  18. await sendPasswordResetEmail();
  19. return;
  20. };
  21. return actions;
  22. };