...
|
...
|
@@ -20,6 +20,16 @@ var NO_AUTH = '没有权限!'; |
|
|
|
|
|
var WEBSITE = 1;
|
|
|
|
|
|
var CSS_FILE = '/css/all.css';
|
|
|
|
|
|
var env = process.env.NODE_ENV || 'development';
|
|
|
|
|
|
//设置对于环境环境
|
|
|
if(env!=='development') {
|
|
|
CSS_FILE = options[env].path+'/all.css';
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 认证中间件
|
|
|
* @param {Object} req 请求对象
|
...
|
...
|
@@ -37,7 +47,7 @@ module.exports = function(req, res, next) { |
|
|
var path = req.route?req.route.path:'';
|
|
|
if(req.session.user&&!checkPath(req.path,req)) {
|
|
|
res.status(403);
|
|
|
res.render('error/error_nolayout',{message:NO_AUTH,layout:false});
|
|
|
res.render('error/error_nolayout',{message:NO_AUTH,layout:false,cssfile:CSS_FILE});
|
|
|
return;
|
|
|
}
|
|
|
//进行白名单验证和session验证
|
...
|
...
|
@@ -58,7 +68,7 @@ module.exports = function(req, res, next) { |
|
|
} else {
|
|
|
req.app.logger.log('info',"CurentView:Login");
|
|
|
//如果是登陆界面不加载布局
|
|
|
res.render('pages/login',{layout:false});
|
|
|
res.render('pages/login',{layout:false,cssfile:CSS_FILE});
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|