Index: ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js =================================================================== diff -u -r37676 -r40881 --- ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js (.../showModifyPWDWindowByExt.js) (revision 37676) +++ ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js (.../showModifyPWDWindowByExt.js) (revision 40881) @@ -1,200 +1,270 @@ +//ZSYY-438:短信验证码 +function sendCodeByModify() { + // Encrypt with the public key... + 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); +} + function showModifyPWDWindow() { -// Ext.QuickTips.init(); //ZSRY-72:增加密码设置要求提示语 var msg = getModifyPwdMsg(); var formObj = new Ext.FormPanel({ - labelAlign : 'left', - frame : true, - labelSeparator : ':', -// title : '密码设置', - bodyStyle : 'padding:5px 5px 0px 25px', - width : 400, - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '旧密码', - inputType : 'password', - name : 'oldPassword', - id : 'oldPassword', - width : 280, - allowBlank : false, - blankText : '请输入旧密码!', - msgTarget : 'side' + labelAlign: 'left', + frame: true, + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 25px', + width: 400, + labelWidth: 80, + items: [{ + xtype: 'textfield', + fieldLabel: '旧密码', + inputType: 'password', + name: 'oldPassword', + id: 'oldPassword', + width: 280, + allowBlank: false, + blankText: '请输入旧密码!', + msgTarget: 'side' }, { - xtype : 'textfield', - fieldLabel : '新密码', - inputType : 'password', - name : 'newPassword', - id : 'newPassword', - width : 280, - allowBlank : false, - blankText : '请输入新密码!', - msgTarget : 'side' + xtype: 'textfield', + fieldLabel: '新密码', + inputType: 'password', + name: 'newPassword', + id: 'newPassword', + width: 280, + allowBlank: false, + blankText: '请输入新密码!', + msgTarget: 'side' }, { - xtype : 'textfield', - fieldLabel : '确认新密码', - inputType : 'password', - name : 'confirmNewPassword', - id : 'confirmNewPassword', - width : 280, - allowBlank : false, - blankText : '请输入确认新密码!', - msgTarget : 'side' + xtype: 'textfield', + fieldLabel: '确认新密码', + inputType: 'password', + name: 'confirmNewPassword', + id: 'confirmNewPassword', + width: 280, + allowBlank: false, + blankText: '请输入确认新密码!', + msgTarget: 'side' }, { - items:[{ - hidden:msg == ''?true:false, - layout:'column', - items:[{ - id:'showPwdMessage', - xtype:'textfield', - width : 390, - allowBlank : true, - labelSeparator:'', - labelWidth:0, + hidden: msg == '' ? true : false, + layout: 'column', + items: [{ + layout: 'form', + columnWidth: .75, + items: [{ + xtype: 'textfield', + fieldLabel: '验证码', + name: 'verificationCode', + id: 'verificationCode', + width: 200, + 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', + items: [{ + id: 'showPwdMessage', + xtype: 'textfield', + width: 390, + allowBlank: true, + labelSeparator: '', + labelWidth: 0, anchor: '99%', - readOnly : true, - cls : 'fieldReadOnlyNoRemove', + readOnly: true, + cls: 'fieldReadOnlyNoRemove', value: msg }] }] }], - buttons : [{ - id : 'saveBtn', - text : '确认', - handler : save + buttons: [{ + id: 'saveBtn', + text: '确认', + handler: saveByVerification }, { - text : '取消', - handler : function(){Ext.getCmp('modifyPWDWindow').close();} + text: '取消', + handler: function () { Ext.getCmp('modifyPWDWindow').close(); } }] }); - function save() { + function saveByVerification() { if (!formObj.form.isValid()) { Ext.MessageBox.show({ - title : '错误提示', - msg : '请正确填写表单各值。', - buttons : Ext.Msg.OK, - icon : Ext.Msg.ERROR + title: '错误提示', + msg: '请正确填写表单各值。', + buttons: Ext.Msg.OK, + icon: Ext.Msg.ERROR }); return false; } + if (sstsConfig.needBeStrongPwdWhenModifyPwd && sstsConfig.enableTwoFactorAuthentication) { + var verificationCode = Ext.getCmp('verificationCode').getValue(); + var encryptedUserCode = encrypt.encrypt(verificationCode); + validateAuthenticationCode(encryptedUserName, encryptedUserCode, function (res) { + if (res.success) { + save(); + } else { + showResult(res.message); + } + }) + } else { + save(); + } + } + + function save() { //暂时屏蔽验证复杂密码 - var checkPasswordResult = testPasswordReg(Ext.getCmp('newPassword').getValue(),userNameID) + var checkPasswordResult = testPasswordReg(Ext.getCmp('newPassword').getValue(), userNameID) if (!checkPasswordResult.success) { Ext.MessageBox.show({ - title : '错误提示', - msg : checkPasswordResult.msg, - buttons : Ext.Msg.OK, - icon : Ext.Msg.ERROR + title: '错误提示', + msg: checkPasswordResult.msg, + buttons: Ext.Msg.OK, + icon: Ext.Msg.ERROR }); return false; } if (Ext.getCmp('newPassword').getValue() != Ext - .getCmp('confirmNewPassword').getValue()) { + .getCmp('confirmNewPassword').getValue()) { Ext.MessageBox.show({ - title : '错误提示', - msg : '新密码与确认新密码不一致,请重新填写!', - buttons : Ext.Msg.OK, - icon : Ext.Msg.ERROR + title: '错误提示', + msg: '新密码与确认新密码不一致,请重新填写!', + buttons: Ext.Msg.OK, + icon: Ext.Msg.ERROR }); return false; } formObj.form.submit({ - url : WWWROOT + '/personalSetting/modifyPWDByExt/save.do', - method : 'POST', - waitMsg : '正在修改密码,请稍候', - waitTitle : '修改密码', - success : function(form, action) { + url: WWWROOT + '/personalSetting/modifyPWDByExt/save.do', + method: 'POST', + waitMsg: '正在修改密码,请稍候', + waitTitle: '修改密码', + success: function (form, action) { if (action.result && action.result.success) { alert("修改密码成功,退出返回登录页面!"); logout(WWWROOT); } else { Ext.MessageBox.show({ - title : '错误提示', - msg : '修改密码失败!', - buttons : Ext.Msg.OK, - icon : Ext.Msg.ERROR + title: '错误提示', + msg: '修改密码失败!', + buttons: Ext.Msg.OK, + icon: Ext.Msg.ERROR }); } }, - failure : function(form, action) { - if(action.result && action.result.message){ + failure: function (form, action) { + if (action.result && action.result.message) { alert(action.result.message); - }else{ - Ext.MessageBox.show({title:'错误提示', msg:'修改密码失败!',buttons:Ext.Msg.OK,icon:Ext.Msg.ERROR}); + } else { + Ext.MessageBox.show({ title: '错误提示', msg: '修改密码失败!', buttons: Ext.Msg.OK, icon: Ext.Msg.ERROR }); } } }); } - - var window = new Ext.Window( { - id : 'modifyPWDWindow', - layout : 'fit', - title : '修改密码', - width : 440, - height : 185, - modal : true, -// autoHeight : true, - border : false, - plain : true, - modal:true, - closeAction:'close', - items : [ formObj ] + + var window = new Ext.Window({ + id: 'modifyPWDWindow', + layout: 'fit', + title: '修改密码', + width: 440, + height: 210, + modal: true, + // autoHeight : true, + border: false, + plain: true, + modal: true, + closeAction: 'close', + items: [formObj] }); - + window.show(); top.Ext.getCmp("oldPassword").focus(false, 100); - if(msg !== ''){ + if (msg !== '') { Ext.getCmp('showPwdMessage').el.dom.style.color = 'red'; } } //DGKHYY-25:显示PDA安装包下载地址的二维码 -function showPDADownloadWindow(){ +function showPDADownloadWindow() { document.getElementById('downloadImage').innerHTML = ''; var imagePanel = new top.Ext.Panel({ - id : 'downloadImagePanel', - layout : 'fit', - bbar : [{ - xtype : 'button', - text : '请在PDA端使用浏览器或下载功能扫描二维码进行下载' + id: 'downloadImagePanel', + layout: 'fit', + bbar: [{ + xtype: 'button', + text: '请在PDA端使用浏览器或下载功能扫描二维码进行下载' }], - items : [{ - xtype : 'box', - id : 'browseImage', - fieldLabel : "二维码", - autoEl : { - id : 'downloadImageBrowse', - tag : 'div', - complete : 'off' - } + items: [{ + xtype: 'box', + id: 'browseImage', + fieldLabel: "二维码", + autoEl: { + id: 'downloadImageBrowse', + tag: 'div', + complete: 'off' + } }] }); - + var url = WWWROOT + '/mobileClient/mobileClientAction!downloadPdaInstallPackage.do'; - var qrcode = new QRCode("downloadImage",url); - setTimeout(function(){ + var qrcode = new QRCode("downloadImage", url); + setTimeout(function () { var imgHtml = document.getElementById('downloadImage').innerHTML; var downloadImageBrowse = top.Ext.get('downloadImageBrowse'); - var image = downloadImageBrowse.dom; + var image = downloadImageBrowse.dom; image.innerHTML = imgHtml; }, 1000); - var window = new top.Ext.Window( { - id : 'PDADownloadWindow', - layout : 'fit', - title : 'PDA客户端下载', - width : 308, - height : 350, - modal : true, - border : false, - plain : true, - modal:true, - closeAction:'close', - items : [ imagePanel ] + var window = new top.Ext.Window({ + id: 'PDADownloadWindow', + layout: 'fit', + title: 'PDA客户端下载', + width: 308, + height: 350, + modal: true, + border: false, + plain: true, + modal: true, + closeAction: 'close', + items: [imagePanel] }); - + window.show(); } \ No newline at end of file