新增同一个用户最大会话数控制
This commit is contained in:
@ -115,6 +115,10 @@ shiro:
|
||||
dbSyncPeriod: 1
|
||||
# 相隔多久检查一次session的有效性,默认就是10分钟
|
||||
validationInterval: 10
|
||||
# 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
|
||||
maxSession: -1
|
||||
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
|
||||
kickoutAfter: false
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
|
@ -22,6 +22,17 @@
|
||||
overflowToDisk="false"
|
||||
statistics="true">
|
||||
</cache>
|
||||
|
||||
<!-- 系统活跃用户缓存 -->
|
||||
<cache name="sys-userCache"
|
||||
maxEntriesLocalHeap="10000"
|
||||
overflowToDisk="false"
|
||||
eternal="false"
|
||||
diskPersistent="false"
|
||||
timeToLiveSeconds="0"
|
||||
timeToIdleSeconds="0"
|
||||
statistics="true">
|
||||
</cache>
|
||||
|
||||
</ehcache>
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
$(function() {
|
||||
validateKickout();
|
||||
validateRule();
|
||||
$('.imgcode').click(function() {
|
||||
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
||||
@ -62,3 +63,33 @@ function validateRule() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function validateKickout() {
|
||||
if (getParam("kickout") == 1) {
|
||||
layer.alert("<font color='red'>您已在别处登录,请您修改密码或重新登录</font>", {
|
||||
icon: 0,
|
||||
title: "系统提示"
|
||||
},
|
||||
function(index) {
|
||||
//关闭弹窗
|
||||
layer.close(index);
|
||||
if (top != self) {
|
||||
top.location = self.location;
|
||||
} else {
|
||||
var url = location.search;
|
||||
if (url) {
|
||||
var oldUrl = window.location.href;
|
||||
var newUrl = oldUrl.substring(0, oldUrl.indexOf('?'));
|
||||
self.location = newUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getParam(paramName) {
|
||||
var reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return decodeURI(r[2]);
|
||||
return null;
|
||||
}
|
Reference in New Issue
Block a user