网站防止用户非法注销

在OA系统中希望记录下用户登录及注销信息,也就是登录用户session失效做的动作,可以采用两种方式联合处理:

1、session范围的监听器(不讲)

2、用户关闭浏览器(没有通过注销按钮),采用js,AJAX 异步处理

如下是类似于方式2的处理:本例中调用的是逻辑流,在普元EOS平台中使用,其它地方可以加入AJax处理:

 

<script type="text/javascript">  
<!--    
   // 防止用户非法注销 
   //IE浏览器 
  window.onbeforeunload = function(){ 
  if(document.all){ 
   var n = window.event.screenX - window.screenLeft;    
   var b = n > document.documentElement.scrollWidth-20; 
   if(b || window.event.clientY < 0 || window.event.altKey){    
   
             //alert("IE关闭"); 
            var logoutbiz = new HideSubmit('com.cdb.use.uaap.auth.LoginManager.SingleLogout.biz');
			var sessionId = '<b:write property="userObject/sessionId" scope="s"/>';
			var uniqueId = '<b:write property="userObject/uniqueId" scope="s"/>';
			var userId =  '<b:write property="userObject/userId" scope="s"/>';
			 
			logoutbiz.addParam('user/sessionId',sessionId);
			logoutbiz.addParam('user/uniqueId',uniqueId);
			logoutbiz.addParam('user/userId',userId);
			
			logoutbiz.submit();
   }else{
       //非关闭 而是刷新
   } 
  } 
} 
// -->  
</script>


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值