增加单点登录
This commit is contained in:
parent
65ae981eca
commit
992a650c52
@ -93,12 +93,16 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S
|
||||
}
|
||||
|
||||
Transaction Sqlca = null;
|
||||
String sUserID = null;
|
||||
String sPWD = null;
|
||||
String sScreenWidth = null;
|
||||
String logonId = null;
|
||||
try {
|
||||
//获得传入的参数:用户登录账号、口令、界面风格
|
||||
String sUserID = request.getParameter("UserID");
|
||||
|
||||
String sPWD = request.getParameter("Password");
|
||||
String sScreenWidth = request.getParameter("ScreenWidth");
|
||||
sUserID = request.getParameter("UserID");
|
||||
logonId = sUserID;
|
||||
sPWD = request.getParameter("Password");
|
||||
sScreenWidth = request.getParameter("ScreenWidth");
|
||||
|
||||
//下拉选框用户快速登陆,系统正式运行后可删除
|
||||
String sUserIDSelected = "";
|
||||
@ -118,6 +122,32 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S
|
||||
//取当前用户和机构,并将其放入 Session
|
||||
ASUser CurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserID),Sqlca);
|
||||
|
||||
//读取上下文单点登陆配置
|
||||
String singleSignon = pageContext.getServletContext().getInitParameter("singleSignon");
|
||||
String loginType = request.getParameter("loginType");
|
||||
if(!"compulsive".equals(loginType) && "true".equals(singleSignon)){
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("select count(1) num from user_list where userid='");
|
||||
sql.append(sUserID);
|
||||
sql.append("' and endtime is null group by userid");
|
||||
String num = Sqlca.getString(new SqlObject(sql.toString()));
|
||||
if(null != num){
|
||||
throw new Exception("false");
|
||||
}
|
||||
}else if("compulsive".equals(loginType)){
|
||||
StringBuffer updateSql = new StringBuffer();
|
||||
updateSql.append("update user_list set endtime='");
|
||||
updateSql.append(StringFunction.getTodayNow().replaceAll(":", "△"));
|
||||
updateSql.append("' where userid='");
|
||||
updateSql.append(sUserID);
|
||||
updateSql.append("'");
|
||||
SqlObject so = new SqlObject(updateSql.toString());
|
||||
so.setDebugSql(so.getDebugSql().replaceAll("△", ":"));
|
||||
so.setOriginalSql(so.getOriginalSql().replaceAll("△", ":"));
|
||||
so.setRunSql(so.getRunSql().replaceAll("△", ":"));
|
||||
Sqlca.executeSQL(so);
|
||||
}
|
||||
|
||||
//设置运行上下文参数 CurARC 在IncludeBegin.jsp中使用
|
||||
RuntimeContext CurARC = new RuntimeContext();
|
||||
CurARC.setAttribute("ScreenWidth",sScreenWidth);
|
||||
@ -134,7 +164,7 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S
|
||||
%><script type="text/javascript">
|
||||
<%
|
||||
String sPWDState = new UserMarkInfo(Sqlca,CurUser.getUserID()).getPasswordState();
|
||||
if(!"Development".equalsIgnoreCase(CurConfig.getConfigure("RunMode")) && // 开发模式不做首次登录/密码过期校验
|
||||
if(true && // 开发模式不做首次登录/密码过期校验
|
||||
(sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_USER_FIRST_LOGON)) || sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_PWD_OVERDUE)))){
|
||||
%>
|
||||
window.open("<%=CurConfig.getContextPath() %>/Redirector?ComponentURL=/AppMain/ModifyPassword.jsp","_top");
|
||||
@ -153,8 +183,17 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S
|
||||
e.printStackTrace(new java.io.PrintWriter(System.out));
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
alert("登录失败,请检查用户名和密码是否输入正确!\n如果您忘记了密码,请与系统管理员联系,恢复初始密码。");
|
||||
window.open("index.html","_top");
|
||||
//alert("登录失败,请检查用户名和密码是否输入正确!\n如果您忘记了密码,请与系统管理员联系,恢复初始密码。");
|
||||
if("false" == "<%=e.getMessage()%>"){
|
||||
if(confirm("发现此账号已登陆中,是否强制登陆?")){
|
||||
window.open("Logon.jsp?loginType=compulsive&UserID=<%=logonId%>&Password=<%=sPWD%>&ScreenWidth=<%=sScreenWidth%>","_top");
|
||||
}else{
|
||||
window.open("index.html","_top");
|
||||
}
|
||||
}else{
|
||||
alert("<%=e.getMessage()%>");
|
||||
window.open("index.html","_top");
|
||||
}
|
||||
</script>
|
||||
<%
|
||||
return;
|
||||
|
||||
@ -436,6 +436,13 @@
|
||||
</init-param>
|
||||
<load-on-startup>5</load-on-startup>
|
||||
</servlet>
|
||||
<!-- 控制单点登陆
|
||||
true: 单点登陆
|
||||
false: 不控制 -->
|
||||
<context-param>
|
||||
<param-name>singleSignon</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>webAppRootKey</param-name>
|
||||
<param-value>webapp.port</param-value>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user