module.factory('sessionTimeoutInterceptor', ['$window',function($window) {
var sessionTimeout = {
response: function(response)
{
if(angular.isString(response.data) && response.data.indexOf("<title>AAA</title>") != -1)
{
$window.location.href = $window.location.origin + '/ls/ls/sp/loginpage/homepage.jsp';
}else
{
return response;
}
}
},
request: function(request)
{
// XSS fixed by yL
var blacklist = ['<script>','</script>','%3Cscript%3E','%3C%2Fscript%3E','<img src='];
//filter blacklist
if(typeof(request.method)=="undefined"||(request.method==null)||(request.method===""))
{
//TODO
}else
{
//clear blacklist key
for (var i = 0; i < blacklist.length; i++)
{
//blacklist[i] /g global /i ignore case
var exp = new RegExp(blacklist[i],'gi');
if(request.method =='GET')
{
request.url = request.url.replace(exp,'');
}else//post
{
if(typeof(request.data)=="undefined"||(request.data==null))
{
//TODO
}else
{
for(var item in request.data)
{
if(typeof request.data[item] === 'string')
{
request.data[item] = request.data[item].replace(exp,'');
} else
{
//TODO
}
}
}
}
};
}
var chkRs = false;
if(common.role==null)
{
//request.url = "/ls/ls/sp/loginpage/noRolePage.html";
}else
{
//customer
if((request.url.indexOf('customer')!=-1)&&(!common.role.my_XXXr))
{
//console.log('customer');
chkRs = true;
}
//policyenquiry
if((request.url.indexOf('policy_enquiry')!=-1)&&(!common.role.policy_XXX))
{
//console.log('policyenquiry');
chkRs = true;
}
//agentenquiry
if((request.url.indexOf('agent_enquiry')!=-1)&&(!common.role.agent_XXX))
{
//console.log('agentenquiry');
chkRs = true;
}
}
if(chkRs)
{
request.url = "/ls//noRolePage.html";
}
return request;
}
};
return sessionTimeout;
}])
.config(
[ '$httpProvider',
function ($httpProvider) {
//timeout Interceptor
$httpProvider.interceptors.push('sessionTimeoutInterceptor');
}
]
var sessionTimeout = {
response: function(response)
{
if(angular.isString(response.data) && response.data.indexOf("<title>AAA</title>") != -1)
{
$window.location.href = $window.location.origin + '/ls/ls/sp/loginpage/homepage.jsp';
}else
{
return response;
}
}
},
request: function(request)
{
// XSS fixed by yL
var blacklist = ['<script>','</script>','%3Cscript%3E','%3C%2Fscript%3E','<img src='];
//filter blacklist
if(typeof(request.method)=="undefined"||(request.method==null)||(request.method===""))
{
//TODO
}else
{
//clear blacklist key
for (var i = 0; i < blacklist.length; i++)
{
//blacklist[i] /g global /i ignore case
var exp = new RegExp(blacklist[i],'gi');
if(request.method =='GET')
{
request.url = request.url.replace(exp,'');
}else//post
{
if(typeof(request.data)=="undefined"||(request.data==null))
{
//TODO
}else
{
for(var item in request.data)
{
if(typeof request.data[item] === 'string')
{
request.data[item] = request.data[item].replace(exp,'');
} else
{
//TODO
}
}
}
}
};
}
var chkRs = false;
if(common.role==null)
{
//request.url = "/ls/ls/sp/loginpage/noRolePage.html";
}else
{
//customer
if((request.url.indexOf('customer')!=-1)&&(!common.role.my_XXXr))
{
//console.log('customer');
chkRs = true;
}
//policyenquiry
if((request.url.indexOf('policy_enquiry')!=-1)&&(!common.role.policy_XXX))
{
//console.log('policyenquiry');
chkRs = true;
}
//agentenquiry
if((request.url.indexOf('agent_enquiry')!=-1)&&(!common.role.agent_XXX))
{
//console.log('agentenquiry');
chkRs = true;
}
}
if(chkRs)
{
request.url = "/ls//noRolePage.html";
}
return request;
}
};
return sessionTimeout;
}])
.config(
[ '$httpProvider',
function ($httpProvider) {
//timeout Interceptor
$httpProvider.interceptors.push('sessionTimeoutInterceptor');
}
]
);
//强制使用IE渲染
<meta http-equiv="X-UA-Compatible" content="IE=edge" />