| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
- <%@page import="cn.sinobest.framework.util.ConfUtil"%>
- <%@page import="cn.sinobest.framework.util.HTMLEncode"%>
- <%
- response.setHeader("Pragma", "No-cache");
- response.setHeader("Cache-Control", "no-cache");
- response.setDateHeader("Expires", 0);
-
- String DeployVersion= ConfUtil.getParam("DEPLOY_VERSION");
- String CheckImage = ConfUtil.getParam("CHECKIMAGE_SB");//是否需要校验码,注意需要修改WEB.XML配置
- String isEncrypty = ConfUtil.getParam("LOGIN_ENCRYPT");//登录时是否加密传输
- String loginTip = ConfUtil.getParam("LOGIN_TIP");//登陆提示信息
- String UNSAFE_VALIDATEFORM = ConfUtil.getParam("UNSAFE_VALIDATEFORM","");
- String LOGINID = request.getParameter("LOGINID") == null
- ? ""
- : HTMLEncode.encode(request.getParameter("LOGINID"));
- String reason = (String) request.getAttribute("reason");//登录失败的原因
- if (reason == null) {
- reason = "";
- }
- String des = String.valueOf(System.currentTimeMillis());
- des = des.substring(des.length()-7);
-
- //清空操作员session对象
- request.getSession().removeAttribute("OPERNAME");
- request.getSession().removeAttribute("OPERID");
- request.getSession().removeAttribute("OPERATOR");
- request.getSession().removeAttribute("LOGINTYPE");
- request.getSession().invalidate();//清空session
- //Cookie cookie = request.getCookies()[0];//获取cookie
- //cookie.setMaxAge(0);//让cookie过期
- Cookie[] cookies = request.getCookies();
- if (cookies != null) {
- for(Cookie c:cookies){
- c.setMaxAge(0);//让cookie过期
- }
- }
-
- request.getSession(true).setAttribute("des_key", des + "hnisi");//密钥
- %>
- <html>
- <head>
- <title>系统登录界面</title>
- <script src="<%=request.getContextPath()%>/js/comm/fw/encrypt.js?v=<%=DeployVersion%>"></script>
- <script src="<%=request.getContextPath()%>/js/comm/fw/encrypt2.js?v=<%=DeployVersion%>"></script>
- <%-- 当需要ajax登录时 ,使用以下代码。请求ajaxlogin.do,传参:LOGINID,PASSWORD
- <% String jsMin = "-min"; %>
- <script src="<%=request.getContextPath()%>/js/comm/lib/jquery<%=jsMin%>.js"></script>
- <script src="<%=request.getContextPath()%>/js/comm/lib/jquery.cookie<%=jsMin%>.js"></script>
- <script src="<%=request.getContextPath()%>/js/comm/lib/json2<%=jsMin%>.js"></script>
- <script src="<%=request.getContextPath()%>/js/comm/fw/ajax<%=jsMin%>.js"></script>
- <script language="javascript">
-
- function doLogin(){
- var contextPath='<%=request.getContextPath()%>';
- var loginid=document.frm.LOGINID.value.toLowerCase();
- var password=document.frm.PASSWORD1.value.toLowerCase();
- for(var unsafei=0;unsafei<fwUnsafeValidateFormTokens.length;unsafei++){
- var lowerUnsafe = fwUnsafeValidateFormTokens[unsafei].toLowerCase().replace(" ","");
- if(-1 != loginid.indexOf(lowerUnsafe) || -1 != password.indexOf(lowerUnsafe)){
- document.all.div_error.style.display="block";
- document.all.div_error.innerHTML="<font color='RED'>登录失败!</font><br/>输入的用户名和密码中包含不安全字符!"
- return false;
- }
- }
-
- setSsoUid();
- _1_();
- frm._1_.value='';
- frm.PASSWORD1.value = '';
- var loginid=document.frm.LOGINID.value;
- var password=document.frm.PASSWORD.value;
-
- var args = {'LOGINID':loginid,'PASSWORD':password};
- $.ajax({
- url:contextPath+'/ajaxlogin.do'
- ,data:$.param(args)
- ,cache:false
- ,async:false
- ,type:'post'
- ,error:function (request, textStatus, errorThrown) {
- alert("登录失败!");
- //错误提示
- }
- ,success:function (data, textStatus) {
- if(data.Token!=null){
- token=data.Token;//更新全局变量token标志
- }
- if (data.flag == 'MFW0001') {
- alert("登录成功!");
- //转跳到首页
- } else {
- alert(data.message);
- //错误提示
- }
-
-
- },
- beforeSend:function(XMLHttpRequest ){
- var cToken = $.cookie("Token") || token;XMLHttpRequest.setRequestHeader('Token',cToken);
- }
-
- });
- }
- </script>
- --%>
- <style>
- body {
- font-size: 12px;
- font-family: 宋体, 微软雅黑;
- background: white;
- font: 900 12px "Arial", Helvetica, sans-serif;
- color: #0d5f83;
- }
- a,table,td,tr,input,select,span,div,textarea,p {
- font-size: 12px;
- font-family: 宋体, 微软雅黑;
- font: 900 12px "宋体", Helvetica, sans-serif;
- }
- .textbox {
- border: #B5B8C8 1px solid;
- color: #000000;
- width: 100%;
- height: 21px;
- background-color: white;
- font-size: 14px;
- font-weight: bold;
- font-family: 宋体, 微软雅黑;
- }
- .img_d {
- background:
- url('<%=request.getContextPath()%>/themes/default/images/login-d.jpg')
- no-repeat left top;
- }
- .img_login {
- background:
- url('<%=request.getContextPath()%>/themes/default/images/login2.jpg')
- no-repeat left top;
- }
- #version {
- width:100%;
- height:30px;
- text-align:center;
- color:red;
- }
- .btn {
- margin:0px 0px 0px 120px;
- padding:2px;
- }
- .btn a {
- float: left;
- text-decoration: none;
- color: #ccc;
- padding: 6px 15px 0 0;
- margin-right: 8px;
- font: 900 12px "宋体", Helvetica, sans-serif;
- }
- .btn a.current {
- background: url('<%=request.getContextPath()%>/themes/default/images/btn_blue.png') no-repeat top right;
- color: #0d5f83;
- }
- .btn a.current span {
- background: url('<%=request.getContextPath()%>/themes/default/images/btn_blue.png') no-repeat top left;
- }
- .btn a span {
- float: left;
- padding-top:2px;
- padding-right: 15px;
- display: block;
- margin-top: -6px;
- height: 24px;
- }
- </style>
- <style>
- .div-loading-hint{
- width: 300px;
- height: 124px;
- border: 1px solid grey;
- position: absolute;
- left : 50%;
- top :50%;
- margin-left:-150px;
- margin-top:-62px;
- text-align: center;
- background:white;
- display: none;
- z-index: 999;
- }
- .div-loading-hint div{
- padding-top:50px;
- }
- .box-shadow{
- filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=2);/*for ie6,7,8*/
- background-color: white;
- -moz-box-shadow:2px 2px 5px #969696;/*firefox*/
- -webkit-box-shadow:2px 2px 5px #969696;/*webkit*/
- box-shadow:2px 2px 5px #969696;/*opera或ie9*/
- }
- .div-loading-hint #loadingTooSlowText{
- display : none;
- color : red;
- }
- </style>
- <script language="javascript">
-
- var isEncrypty = '<%=isEncrypty%>';
- var fwUnsafeValidateFormTokens = "<%=UNSAFE_VALIDATEFORM%>".split("|");
- function fKeyPress(obj){
- var keycode;
- keycode=window.event.keyCode;
- if (keycode==0xD) {
- if(obj.name=="LOGINID" && obj.value != ""){
- document.frm.PASSWORD1.focus();
- document.frm.PASSWORD1.select();
- }else if(obj.name=="PASSWORD1"){
- if(document.frm.IMAGCHECK){
- document.frm.IMAGCHECK.focus();
- document.frm.IMAGCHECK.select();
- }else{
- doSubmit();
- }
- }else if(obj.name="IMAGCHECK"){
- doSubmit();
- }
- }
- }
-
- function _1_(){
- var pw = frm.PASSWORD1.value;
- var t = pw;
- if (isEncrypty == '1') {
- var _1 = frm._1_.value;
- t = stringToHex(encrypt(_1,pw));
- }
- frm.PASSWORD.value = t;
- }
-
- function init(){
- document.frm.LOGINID.focus();
- document.frm.LOGINID.value=GetCookie("RS_ID");
- document.frm.PASSWORD1.value=GetCookie("RS_PW");
- <%if (!reason.equals("")) {%>
- document.all.div_error.style.display="block";
- document.all.div_error.innerHTML="<font color='RED'>登录失败!</font><br/><%=reason%>";
- <%}else{%>
- //如果用户密码不为空自动登录
- if(document.frm.LOGINID.value != "" && document.frm.PASSWORD1.value !=""){
- doSubmit();
- }
- <%}%>
- isIE8();
- }
-
- function doSubmit(){
- if (document.frm.LOGINID.value == "" || document.frm.PASSWORD1.value =="") {
- document.all.div_error.style.display="block";
- document.all.div_error.innerHTML="<font color='RED'>登录失败!</font><br/>请输入用户名和密码!"
- return false;
- }else{
- var loginid=document.frm.LOGINID.value.toLowerCase();
- var password=document.frm.PASSWORD1.value.toLowerCase();
- for(var unsafei=0;unsafei<fwUnsafeValidateFormTokens.length;unsafei++){
- var lowerUnsafe = fwUnsafeValidateFormTokens[unsafei].toLowerCase().replace(" ","");
- if(-1 != loginid.indexOf(lowerUnsafe) || -1 != password.indexOf(lowerUnsafe)){
- document.all.div_error.style.display="block";
- document.all.div_error.innerHTML="<font color='RED'>登录失败!</font><br/>输入的用户名和密码中包含不安全字符!"
- return false;
- }
- }
- }
- <%
- String ENABLE_LOGINHINT = ConfUtil.getParam("ENABLE_LOGINHINT","TRUE");
- if(ENABLE_LOGINHINT.equalsIgnoreCase("TRUE")){
- %>
- fnShowLoadingHint();
- <%
- }
- %>
- setSsoUid();
- _1_();
-
- //用户记住密码时才保存cookie
- if(document.frm.RememberMe.checked){
- createCookie("RS_ID",document.frm.LOGINID.value,86400000000,"/");
- createCookie("RS_PW",document.frm.PASSWORD1.value,86400000000,"/");
- }
- frm._1_.value='';
- frm.PASSWORD1.value = '';
- document.frm.submit();
-
- }
-
- function doReset(){
- document.frm.LOGINID.value = '';
- document.frm.PASSWORD1.value = '';
- if(document.frm.IMAGCHECK){
- document.frm.IMAGCHECK.value='';
- }
- document.frm.LOGINID.focus();
- }
- function refresh(){
- var src = document.getElementById("authImg").src;
- document.getElementById("authImg").src=src+"?now="+new Date();
- }
- /*屏蔽特殊字符*/
- function LOGINID_keydown(event){
- switch(event.keyCode){
- case 220://屏蔽 \
- return false;
- default:
- return true;
- }
- }
- function isIE8(){
- var brower = navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);
- var version = brower ? brower[1] : 0;
-
- if (parseInt(version) < 8) {
- document.getElementById("version").innerText = "【请使用IE9版本登录使用本系统,其他浏览器或IE版本不确保完全兼容。】";
- }
- }
- function GetCookie(name){
- var arg = name + "=";
- var alen = arg.length;
- var clen = document.cookie.length;
- var i = 0;
- while (i < clen)
- {
- var j = i + alen;
- if (document.cookie.substring(i, j) == arg)
- return GetCookieVal (j);
- i = document.cookie.indexOf(" ", i) + 1;
- if (i == 0) break;
- }
- return "";
- }
- function GetCookieVal(offset){
- var endstr = document.cookie.indexOf (";", offset);
- if (endstr == -1)
- endstr = document.cookie.length;
- return unescape(document.cookie.substring(offset, endstr));
- }
- </script>
- </head>
- <body leftmargin="0" topmargin="0" onload="init()">
- <FORM name="frm" method="post" action="<%=request.getContextPath()%>/framework/security/loginsb!login.do">
- <input type="hidden" name="_rtnURL" value="<%=request.getContextPath()%>/framework/security/loginsb.do" />
- <input type="hidden" name="PASSWORD"></input>
- <input type="hidden" name="_1_" value="<%=des%>"></input>
- <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="950" height="600" class="img_login">
- <table height="600" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td width="450">
- <div style="position:relative;top:85px;color:red;font-size:20px;text-align:right" id="loginTip">
- </div>
- </td>
- <td valign="top">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td> </td>
- <td width="335" height="370"> </td>
- </tr>
- <tr>
- <td> </td>
- <td><table width="335" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td> </td>
- <td height="45"> </td>
- </tr>
- <tr>
- <td width="31%"><div align="right" class="unnamed1">登录ID:</div></td>
- <td width="69%"><input name="LOGINID" class="textbox" type="text" onkeydown="return LOGINID_keydown(event)" onKeyUp="fKeyPress(this)"
- onBlur="this.value=this.value.replace(/[\u4E00-\u9FA5]/g,'')" style="width: 154px" maxlength=18 ></td>
- </tr>
- <tr>
- <td>
- <div align="right" class="unnamed1">密 码:</div></td>
- <td><input name="PASSWORD1" class="textbox" autocomplete="off" type="password" onKeyUp="fKeyPress(this)" style="width: 154px" maxlength=20></td>
- </tr>
- <tr>
- <td></td>
- <td><input name="RememberMe" type="checkbox">记住帐号密码</td>
- </tr>
- <%
- if (CheckImage.equals("1")) {
- %>
- <%--图形校验码--%>
- <tr>
- <td><div align="right" class="unnamed1">校验码:</div></td>
- <td><input name="IMAGCHECK" class="textbox" type="text" style="width: 90px" onKeyUp="fKeyPress(this)" size="5" maxlength="4">
- <a title="单击刷新" href="javascript:void(0)" onclick="refresh()"><img id="authImg" src="<%=request.getContextPath()%>/ImageCheck.jpg"
- height="20" border=0 align="absmiddle"
- />
- </td>
- </tr>
- <%
- }
- %>
- <tr>
- <td height="45" colspan="2" >
- <div class="btn" >
- <a href="javascript:void(0);" class="current" onclick="doSubmit();return false;"><span></span>登录</a>
- <a href="javascript:void(0);" class="current" onclick="doReset();return false;"><span></span>清除</a>
- </div>
- </td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td></td>
- <td width="275">
- <div id="div_error" style="display: none"></div>
- </td>
- </tr>
- </table></td>
- </tr>
- </table></td>
- <td height="600" class="img_d"> </td>
- </tr>
- <tr>
- <td colspan="2">
- <div id="version">
-
- </div>
- </td>
- </tr>
- </table>
- </FORM>
- <div id="loadingHint" class="div-loading-hint box-shadow">
- <div>
- <span id="loadingHintText">正在登录,请稍候</span>
- <span id="loadingHintDot"></span>
- <br></br>
- <span id="loadingTooSlowText"><%=ConfUtil.getParam("LOGIN_SLOW_HINT","您的网络速度较为缓慢,请耐心等候") %></span>
- </div>
- </div>
- <DIV id="divDiableScreen" style="display:none;Z-INDEX: 100; POSITION: absolute; FILTER: alpha(opacity=15); BACKGROUND-COLOR: #000; WIDTH: 100%; HEIGHT: 100%; TOP: 0px; LEFT: 0px; opacity: 0.15" >
- <IFRAME style="Z-INDEX: -1; POSITION: absolute; FILTER: progid:DXImageTransform.Microsoft.Alpha(opacity:0); WIDTH: 100%; HEIGHT: 100%; TOP: 0px; LEFT: 0px" src="about:blank" frameBorder=0></IFRAME>
- <DIV style="Z-INDEX: -1; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0px; LEFT: 0px"> </DIV>
- </DIV>
-
- <script>
- (function(){
- //点击提交后经过的秒数
- var secondsAfterSubmit = 0;
- var interval;
- window.fnShowLoadingHint = function(){
- divDiableScreen.style.height = document.body.scrollHeight;
- divDiableScreen.style.display = 'block';
- loadingHint.style.display = 'block';
- interval = setInterval(function(){
- secondsAfterSubmit += 0.5;
- loadingHintDot.innerText = loadingHintDot.innerText + '.';
- if(loadingHintDot.innerText.length >3){
- loadingHintDot.innerText = '';
- }
- if(secondsAfterSubmit>2){
- loadingTooSlowText.style.display = "block";
- }
- },500);
- }
-
- bindListener(window,'unload',function(e){
- clearInterval(interval);
- });
- function bindListener(obj,eventName,fun) {
- if (obj.addEventListener) {
- obj.addEventListener(eventName,fun,false);
- } else if (obj.attachEvent) {
- obj.attachEvent('on'+eventName,fun);
- } else {
- obj['on'+eventName] = fun;
- }
- }
-
- })();
- </script>
- <script>
- loginTip.innerHTML = "<%=loginTip%>";
-
- function characterHideAndShow(){
- loginTip.style.display = (loginTip.style.display=='none'?'block':'none');
- if('none'==loginTip.style.display){//隐藏一秒后显示
- setTimeout("characterHideAndShow()",1000);
- }else{//显示3秒后隐藏
- setTimeout("characterHideAndShow()",3000);
- }
- }
- characterHideAndShow();
- </script>
- </body>
- </html>
|