Index: ssts-web/src/main/webapp/logon.jsp =================================================================== diff -u -r30237 -r30498 --- ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 30237) +++ ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 30498) @@ -131,7 +131,7 @@ - +
@@ -219,18 +219,43 @@ if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } - function submitForm(){ - document.loginForm.submit(); - } +/** + * 退出登录 + */ +function logoutSystem(){ + //如果已经登录的话,则退出,否则如果没有登录的将无法进行请求,不会处理.(切记:千万不能直接调用登出,否则将死循环) + $.ajax({ + type:'get', + dataType:'json', + url : '${ctx}/systemmanage/user/userAction!detectLogin.do', + data : "date=" + new Date().toGMTString(), + success : function(response, options) { + try{ + // 此处返回的有可能不是json字符串,因为注销之后,会被acegi拦截,返回html + if(response && response.success){ + document.location.href = "${ctx}/j_spring_security_logout"; + }else{ + + } + }catch(e){ + // + } + } + }); +} - function resetForm(){ - document.getElementById("j_username_display").value = ""; - document.getElementById("j_password_display").value = ""; - document.getElementById("j_password").value = ""; - document.getElementById("tip").innerHTML = " "; - setFieldFocus(document.getElementById("j_username_display")); - } +function submitForm(){ + document.loginForm.submit(); +} +function resetForm(){ + document.getElementById("j_username_display").value = ""; + document.getElementById("j_password_display").value = ""; + document.getElementById("j_password").value = ""; + document.getElementById("tip").innerHTML = " "; + setFieldFocus(document.getElementById("j_username_display")); +} + // 自动补全登录名 function autoFillUserName() { Index: forgon-core/src/main/java/com/forgon/security/action/UserAction.java =================================================================== diff -u -r27076 -r30498 --- forgon-core/src/main/java/com/forgon/security/action/UserAction.java (.../UserAction.java) (revision 27076) +++ forgon-core/src/main/java/com/forgon/security/action/UserAction.java (.../UserAction.java) (revision 30498) @@ -88,6 +88,23 @@ } StrutsResponseUtils.output(obj); } + + /** + * 检测是否有登录 + */ + public void detectLogin() { + JSONObject obj = new JSONObject(); + obj.put("success", false); + try { + LoginUserData loginUserData = AcegiHelper.getLoginUser(); + if(loginUserData != null){ + obj.put("success", true); + } + } catch (Exception e) { + e.printStackTrace(); + } + StrutsResponseUtils.output(obj); + } /** * 通过用户条码获取用户的信息.