Explorar el Código

improved middleware

kaori hace 4 años
padre
commit
0ec69ef01a
Se han modificado 1 ficheros con 7 adiciones y 10 borrados
  1. 7 10
      src/server/middlewares/password-reset.js

+ 7 - 10
src/server/middlewares/password-reset.js

@@ -1,13 +1,10 @@
 module.exports = (crowi, app) => {
-  // const { configManager } = crowi;
 
-  // when disabled
-  // if (!configManager.getConfig('crowi', 'promster:isEnabled')) {
-  //   return (req, res, next) => next();
-  // }
-
-  // const { createMiddleware } = require('@promster/express');
-  // return createMiddleware({ app });
-  console.log('middleware');
-  return (req, res, next) => next();
+  return (req, res, next) => {
+    // check the oneTimeToken is valid
+    if (req.token == null /* || token.isExpired() */) {
+      return res.redirect('/login');
+    }
+    return next();
+  };
 };