kaori 4 лет назад
Родитель
Сommit
5dc383b1fa
2 измененных файлов с 0 добавлено и 59 удалено
  1. 0 57
      src/server/routes/forgot-password.js
  2. 0 2
      src/server/routes/index.js

+ 0 - 57
src/server/routes/forgot-password.js

@@ -1,11 +1,4 @@
-// const logger = require('@alias/logger')('growi:routes:forgot-password');
-// const ApiResponse = require('../util/apiResponse');
-
 module.exports = function(crowi, app) {
-  // const PasswordResetOrder = crowi.model('PasswordResetOrder');
-  // const User = crowi.model('User');
-  // const { appService, mailService, configManager } = crowi;
-  // const path = require('path');
   const actions = {};
   const api = {};
   actions.api = api;
@@ -20,39 +13,6 @@ module.exports = function(crowi, app) {
     return res.render('reset-password', { email });
   };
 
-  // async function sendPasswordResetEmail(email, url, i18n) {
-  //   return mailService.send({
-  //     to: email,
-  //     subject: 'Password Reset',
-  //     template: path.join(crowi.localeDir, `${i18n}/notifications/passwordReset.txt`),
-  //     vars: {
-  //       appTitle: appService.getAppTitle(),
-  //       email,
-  //       url,
-  //     },
-  //   });
-  // }
-
-  // api.post = async function(req, res) {
-  //   const { email } = req.body;
-  //   const grobalLang = configManager.getConfig('crowi', 'app:globalLang');
-  //   const i18n = req.language || grobalLang;
-  //   const appUrl = appService.getSiteUrl();
-
-  //   try {
-  //     const passwordResetOrderData = await PasswordResetOrder.createPasswordResetOrder(email);
-  //     const url = new URL(`/forgot-password/${passwordResetOrderData.token}`, appUrl);
-  //     const oneTimeUrl = url.href;
-  //     await sendPasswordResetEmail(email, oneTimeUrl, i18n);
-  //     return res.json(ApiResponse.success());
-  //   }
-  //   catch (err) {
-  //     const msg = 'Error occurred during password reset request procedure';
-  //     logger.error(err);
-  //     return res.json(ApiResponse.error(msg));
-  //   }
-  // };
-
   actions.error = function(req, res) {
     const { reason } = req.params;
 
@@ -61,22 +21,5 @@ module.exports = function(crowi, app) {
     }
   };
 
-
-  // api.put = async(req, res) => {
-  //   const { email, newPassword } = req.body;
-
-  //   const user = await User.findOne({ email });
-
-  //   try {
-  //     const userData = await user.updatePassword(newPassword);
-  //     return res.apiv3({ userData });
-  //   }
-  //   catch (err) {
-  //     logger.error(err);
-  //     return res.json(ApiResponse.error('update-password-failed'));
-  //   }
-  // };
-
-
   return actions;
 };

+ 0 - 2
src/server/routes/index.js

@@ -178,10 +178,8 @@ module.exports = function(crowi, app) {
   app.post('/_api/hackmd.saveOnHackmd'   , accessTokenParser , loginRequiredStrictly , csrf, hackmd.validateForApi, hackmd.saveOnHackmd);
 
   app.get('/forgot-password', forgotPassword.forgotPassword);
-  // app.post('/_api/forgot-password', forgotPassword.api.post);
   app.get('/forgot-password/:token'      , passwordReset, forgotPassword.resetPassword);
   app.get('/forgot-password/error/:reason'      , applicationInstalled, forgotPassword.error);
-  // app.put('/_api/forgot-password'      , applicationInstalled, forgotPassword.api.put);
 
   app.get('/share/:linkId', page.showSharedPage);