Authored by 周奇琪

Merge branch 'hotfix/loginbug' into develop

Conflicts:
	server/views/pages/login.html
var config = require('../config/gray');
var request = require('request');
var options=require('../staticConfig.js').staticDir;
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} data 通过接口获取到的数据
... ... @@ -45,14 +56,14 @@ exports.post = function(data, req, res) {
res.redirect(url);
} else {
res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false});
res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false,cssfile:CSS_FILE});
}
});
return;
} else {
//否则跳转错误
res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false});
res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false,cssfile:CSS_FILE});
return;
}
}
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@ exports.res =
type: 'String',
maxLength: 16,
minLength: 6,
reg: /[0-9A-Za-z]{6,16}/,
reg: /^\S{6,16}/,
message: '必须是6-16位的字符'
}]
},{
... ...
... ... @@ -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});
}
}
... ...
... ... @@ -7,7 +7,7 @@
<title>error</title>
<link href="/css/all.css" rel="stylesheet">
<link href="{{cssfile}}" rel="stylesheet">
</head>
<body class="pace-done">
... ...