Index: ssts-web/src/main/webapp/logon.jsp =================================================================== diff -u -r37356 -r39011 --- ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 37356) +++ ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 39011) @@ -183,6 +183,18 @@ .showForm .userItem input{ height: 25px; } + .showForm3 { + width: 370px; + margin-top: 10px; + } + .showForm3 .canvas { + border:1px solid #ccc; + border-radius:5px; + } + .showForm3 .canvasDiv { + text-align: center; + margin: 5px; + } .button { /* 按钮美化 */ width: 100px; /* 宽度 */ height: 25px; /* 高度 */ @@ -209,6 +221,15 @@ .buttonItem { text-align: center; } + .showForm3 .buttonItem { + margin-top:20px + } + .showForm3 button { + width: 100px; + } + #idBox3 { + height: 250px; + } button[disabled] { color: #555 !important; background: #ccc !important;eee @@ -261,6 +282,27 @@ +
@@ -365,7 +407,7 @@ } //弹出验证码的窗口 -var ab1,ab2; +var ab1,ab2,ab3; function alertBox1(userName,phoneNumber){ ab1 = new AlertBox("idBox1",{ fixed:true, @@ -386,6 +428,102 @@ ab1.show(); } +var show_num = []; +//GZSZYY-83:二次验证 +function alertBox3(){ + ab3 = new AlertBox("idBox3",{ + fixed:true, + onShow: function(){ + var clientWidth = document.body.clientWidth; + var clientHeight = document.body.clientHeight; + + var left = (clientWidth > 410)?(clientWidth - 410)/2:0; + var top = (clientHeight > 310)?(clientHeight - 310)/2:0; + + document.getElementById('idBox3').style.left = left + 'px'; + document.getElementById('idBox3').style.top = top + 'px'; + + show_num = []; + drawVerifiyCode(); + } + }); + ab3.show(); +} + +//GZSZYY-83:随机验证码 +function drawVerifiyCode() { + var canvas_width = document.getElementById('canvas').clientWidth; + var canvas_height = document.getElementById('canvas').clientHeight; + var canvas = document.getElementById("canvas"); + var context = canvas.getContext("2d"); + canvas.width = canvas_width; + canvas.height = canvas_height; + var sCode = "A,B,C,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m"; + var aCode = sCode.split(","); + var aLength = aCode.length;//获取到数组的长度 + + for (var i = 0; i <= 3; i++) { + var j = Math.floor(Math.random() * aLength); + var deg = Math.random() * 30 * Math.PI / 180; + var txt = aCode[j]; + show_num[i] = txt; + var x = 30 + i * 20; + var y = 30 + Math.random() * 8; + context.font = "bold 30px 微软雅黑"; + + context.translate(x, y); + context.rotate(deg); + + context.fillStyle = randomColor(); + context.fillText(txt, 0, 0); + + context.rotate(-deg); + context.translate(-x, -y); + } + for (var i = 0; i <= 5; i++) { //验证码上显示线条 + context.strokeStyle = randomColor(); + context.beginPath(); + context.moveTo(Math.random() * canvas_width, Math.random() * canvas_height); + context.lineTo(Math.random() * canvas_width, Math.random() * canvas_height); + context.stroke(); + } + for (var i = 0; i <= 30; i++) { //验证码上显示小点 + context.strokeStyle = randomColor(); + context.beginPath(); + var x = Math.random() * canvas_width; + var y = Math.random() * canvas_height; + context.moveTo(x, y); + context.lineTo(x + 1, y + 1); + context.stroke(); + } +} + +//判断验证码是否一样 +function verificationCode(){ + var code = show_num.join(''); + var verCode = document.getElementById('verCode').value; + if(verCode == ''){ + alert('请输入验证码'); + return + } + if(code.toLowerCase() !== verCode.toLowerCase()){ + alert('验证码输入错误,请重新输入。'); + drawVerifiyCode(); + return + } + + document.loginForm.submit(); + hideBox3(); +} + +//得到随机的颜色值 +function randomColor() { + var r = Math.floor(Math.random() * 256); + var g = Math.floor(Math.random() * 256); + var b = Math.floor(Math.random() * 256); + return "rgb(" + r + "," + g + "," + b + ")"; +} + //关闭验证码的窗口 function hideBox1(){ ab1.close(); @@ -396,6 +534,11 @@ ab2.close(); } +//关闭二次验证的窗口 +function hideBox3(){ + ab3.close(); +} + //忘记密码 function forgetPassword(){ var userName = document.getElementById("j_username_display").value; @@ -673,7 +816,13 @@ autoFillUserName(); sessionStorage.setItem('loginPassword',encryptedPassword); sessionStorage.setItem('loginUserName',encryptedUserName); - document.loginForm.submit(); + + //GZSZYY-83:登录二次验证类型 + if(sstsConfig.logInTwoFactorAuthenticationType == 1){ + alertBox3() + }else { + document.loginForm.submit(); + } } function setFieldFocus(objField) { Index: ssts-web/src/main/webapp/disinfectsystem/config/gzszyy/config.js =================================================================== diff -u -r38694 -r39011 --- ssts-web/src/main/webapp/disinfectsystem/config/gzszyy/config.js (.../config.js) (revision 38694) +++ ssts-web/src/main/webapp/disinfectsystem/config/gzszyy/config.js (.../config.js) (revision 39011) @@ -169,6 +169,8 @@ enableChineseMedicineApparatusFunction:true, //启用在线考试功能 enableOnlineExamsFunction:true, +//登录二次验证类型 +logInTwoFactorAuthenticationType:1, //关闭自定义表单功能 closeFormDefinition:false } \ No newline at end of file