Index: ssts-web/src/main/webapp/logon.jsp =================================================================== diff -u -r40881 -r40886 --- ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 40881) +++ ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 40886) @@ -356,6 +356,9 @@ // 保存到cookie setCookie('ENABLE_SPEECH_RECOGNITION',ENABLE_SPEECH_RECOGNITION,10000*365); } +var publicKey = "<%=logonRSAPublicKey %>"; +var encrypt = new JSEncrypt(); +encrypt.setPublicKey(publicKey); if(sstsConfig.logoSetting){ var logoWidth = sstsConfig.logoSetting.width || 215; @@ -365,14 +368,45 @@ height:logoHeight+'px' }) } + +//ZSYY-438:短信验证码 +function sendCodeByModify() { + // Encrypt with the public key... + var userName = document.getElementById("j_username_display").value; + var encryptedUserName = encrypt.encrypt(userName); + sendAuthenticationCodeSms(encryptedUserName, function (res) { + if (res.success) { + setCodeTimeoutByModify(); + } + }) +} +var time2 = 60; +//倒计时 +function setCodeTimeoutByModify() { + var button = Ext.getCmp('senCode'); + var t = setTimeout(function () { + if (time2 > 0) { + time2--; + button.setText(time2 + ' s'); + button.setDisabled(true); + setCodeTimeoutByModify(); + } else { + clearTimeout(t); + time2 = 60; + button.setText('发送验证码'); + button.setDisabled(false); + } + }, 1000); +} + var modifyPWDWindow = null; //GZSZYY-121:弹出修改密码的窗口 function showModifyPWDWindowByUnmodified() { - var publicKey = "<%=logonRSAPublicKey %>"; - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); //ZSRY-72:增加密码设置要求提示语 var msg = getModifyPwdMsg(); + if(msg !== '' && sstsConfig.enableTwoFactorAuthentication == 1){ + hideSenCode = false; + } var formObj = new top.Ext.FormPanel({ labelAlign : 'left', @@ -426,6 +460,34 @@ blankText : '请输入确认新密码!', msgTarget : 'side' }, { + hidden: hideSenCode, + layout: 'column', + items: [{ + layout: 'form', + columnWidth: .75, + items: [{ + xtype: 'textfield', + fieldLabel: '验证码', + name: 'smsVerificationCode', + id: 'smsVerificationCode', + width: 170, + msgTarget: 'side', + allowBlank: true + }] + }, { + layout: 'form', + columnWidth: .25, + items: [{ + id: 'senCode', + xtype: 'button', + text: '发送验证码', + disabled: false, + handler: function () { + sendCodeByModify(); + } + }] + }] + }, { items:[{ hidden:msg == ''?true:false, layout:'column', @@ -446,14 +508,14 @@ buttons : [{ id : 'saveBtn', text : '确认', - handler : save + handler : saveByVerification }, { text : '取消', handler : function(){top.Ext.getCmp('modifyPWDWindow').close();} }] }); - function save() { + function saveByVerification(){ if (!formObj.form.isValid()) { top.Ext.MessageBox.show({ title : '错误提示', @@ -483,6 +545,24 @@ }); return false; } + if (sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication == 1) { + var smsVerificationCode = Ext.getCmp('smsVerificationCode').getValue(); + var encryptedUserCode = encrypt.encrypt(smsVerificationCode); + var userName = document.getElementById("j_username_display").value; + var encryptedUserName = encrypt.encrypt(userName); + validateAuthenticationCode(encryptedUserName, encryptedUserCode, function (res) { + if (res.success) { + save(); + } else { + showResult(res.message); + } + }) + } else { + save(); + } + } + + function save() { formObj.form.submit({ url : WWWROOT + '/personalSetting/modifyPWDByExt/save.do', method : 'POST', @@ -706,7 +786,7 @@ hideBox3(); //ZSYY-438:短信验证 - if(sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication){ + if(sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication == 1){ var checkPasswordResult = testPasswordReg(j_password_display.value,j_username_display.value); if (checkPasswordResult.success) { needModifyPwd(); @@ -820,10 +900,6 @@ //GZSZYY-83:登录二次验证类型 var userName = document.getElementById("j_username_display").value; var userCode = document.getElementById("userCode").value; - var publicKey = "<%=logonRSAPublicKey %>"; - // Encrypt with the public key... - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); var encryptedUserName = encrypt.encrypt(userName); var encryptedUserCode = encrypt.encrypt(userCode); validateAuthenticationCode(encryptedUserName, encryptedUserCode, function(res){ @@ -855,10 +931,6 @@ alert(checkPasswordResult.msg); return false; } - //对用户名、密码进行rsa加密 - var publicKey = "<%=logonRSAPublicKey %>"; - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); var encryptedUserName = encrypt.encrypt(userName); var encryptedPassword = encrypt.encrypt(confirmPwd); $.ajax({ @@ -916,10 +988,6 @@ alert('用户名不存在'); return; } - var publicKey = "<%=logonRSAPublicKey %>"; - // Encrypt with the public key... - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); var encryptedUserName = encrypt.encrypt(userName); sendAuthenticationCodeSms(encryptedUserName,function(res){ if(res.success){ @@ -949,10 +1017,6 @@ //验证是否绑定手机号 function isBindPhone(userName, type){ - //对用户名进行rsa加密 - var publicKey = "<%=logonRSAPublicKey %>"; - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); var encryptedUserName = encrypt.encrypt(userName); $.ajax({ type:'post', @@ -1066,11 +1130,6 @@ function checkSubmit() { var inputPassword = j_password_display.value; var inputUserName = j_username_display.value; - - var publicKey = "<%=logonRSAPublicKey %>"; - // Encrypt with the public key... - var encrypt = new JSEncrypt(); - encrypt.setPublicKey(publicKey); var encryptedPassword = encrypt.encrypt(inputPassword); var encryptedUserName = encrypt.encrypt(inputUserName); @@ -1117,7 +1176,7 @@ alertBox3() }else { //ZSYY-438:短信验证 - if(sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication){ + if(sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication == 1){ var checkPasswordResult = testPasswordReg(j_password_display.value,j_username_display.value); if (checkPasswordResult.success) { needModifyPwd();