test router fix

v1.18.x
Baris Usakli 8 years ago
parent e9639833c5
commit 6087f3c8cd

@ -117,10 +117,10 @@ Plugins.reload = function (callback) {
Plugins.reloadRoutes = function (callback) {
var router = express.Router();
var ensureLoggedIn = require('connect-ensure-login');
// var ensureLoggedIn = require('connect-ensure-login');
router.all('(/api/admin|/api/admin/*?)', middleware.isAdmin);
router.all('(/admin|/admin/*?)', ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login?local=1'), middleware.applyCSRF, middleware.isAdmin);
// router.all('(/api/admin|/api/admin/*?)', middleware.isAdmin);
// router.all('(/admin|/admin/*?)', ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login?local=1'), middleware.applyCSRF, middleware.isAdmin);
router.hotswapId = 'plugins';
router.render = function () {

@ -118,8 +118,8 @@ module.exports = function (app, middleware, hotswapIds, callback) {
app.all(relativePath + '(/api/admin|/api/admin/*?)', middleware.isAdmin);
app.all(relativePath + '(/admin|/admin/*?)', ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login?local=1'), middleware.applyCSRF, middleware.isAdmin);
router.all('(/api/admin|/api/admin/*?)', middleware.isAdmin);
router.all('(/admin|/admin/*?)', ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login?local=1'), middleware.applyCSRF, middleware.isAdmin);
// router.all('(/api/admin|/api/admin/*?)', middleware.isAdmin);
// router.all('(/admin|/admin/*?)', ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login?local=1'), middleware.applyCSRF, middleware.isAdmin);
adminRoutes(router, middleware, controllers);
metaRoutes(router, middleware, controllers);
@ -138,7 +138,7 @@ module.exports = function (app, middleware, hotswapIds, callback) {
groupRoutes(router, middleware, controllers);
for (x = 0; x < routers.length; x += 1) {
app.use(relativePath, routers[x]);
app.use(relativePath ? relativePath : '/', routers[x]);
}
if (process.env.NODE_ENV === 'development') {

Loading…
Cancel
Save