Index: ssts-web/src/main/webapp/homepage/portalPage.js =================================================================== diff -u -r40633 -r40635 --- ssts-web/src/main/webapp/homepage/portalPage.js (.../portalPage.js) (revision 40633) +++ ssts-web/src/main/webapp/homepage/portalPage.js (.../portalPage.js) (revision 40635) @@ -856,30 +856,6 @@ }); store.load(); windowOnLoaded = true; - /** - * ajax异步请求后台,当前用户是否已经修改密码 - */ - /*simon:update添加条件判断,needForceModifyPwdWhenFirstTime第一次登陆时是否需要强制修改密码*/ - if(sstsConfig.needForceModifyPwdWhenFirstTime || sstsConfig.forceUserChangePwdWhenNotMeetPwdComplexityReq){ - var loginPassword = sessionStorage.getItem('loginPassword') || ''; - var loginUserName = sessionStorage.getItem('loginUserName') || ''; - Ext.Ajax.request({ - url : WWWROOT + '/systemmanage/user/userAction!isModifiedPwdByUser.do', - method: 'POST', - async:true, - params : { - "password":loginPassword, - "userName":loginUserName - }, - success : function(response, options){ - var result = Ext.decode(response.responseText, true); - //没有修改 - if(!result){ - showModifyPWDWindowByUnmodified(); - } - } - }); - } }); function initTipPosition(){ Index: ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml =================================================================== diff -u -r40531 -r40635 --- ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 40531) +++ ssts-web/src/main/webapp/WEB-INF/spring/security-standard/applicationContext-acegi-security.xml (.../applicationContext-acegi-security.xml) (revision 40635) @@ -131,6 +131,9 @@ + + + Index: ssts-web/src/main/webapp/logon.jsp =================================================================== diff -u -r40532 -r40635 --- ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 40532) +++ ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 40635) @@ -120,6 +120,7 @@ +<%@ include file="/common/includeExtJsAndCss.jsp"%> @@ -356,6 +357,180 @@ }) } +//GZSZYY-121:弹出修改密码的窗口 +function showModifyPWDWindowByUnmodified() { + var publicKey = "<%=logonRSAPublicKey %>"; + var encrypt = new JSEncrypt(); + encrypt.setPublicKey(publicKey); + //ZSRY-72:增加密码设置要求提示语 + var msg = getModifyPwdMsg(); + + var formObj = new top.Ext.FormPanel({ + labelAlign : 'left', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 25px', + width : 400, + labelWidth : 80, + items : [{ + xtype:'hidden', + id:'userName', + name:'userName' + },{ + xtype : 'textfield', + fieldLabel : '旧密码', + inputType : 'password', + name : 'oldPassword', + id : 'oldPassword', + width : 250, + allowBlank : false, + blankText : '请输入旧密码!', + msgTarget : 'side' + }, { + xtype : 'textfield', + fieldLabel : '新密码', + inputType : 'password', + name : 'newPassword', + id : 'newPassword', + width : 250, + allowBlank : false, + blankText : '请输入新密码!', + msgTarget : 'side' + }, { + xtype : 'textfield', + fieldLabel : '确认新密码', + inputType : 'password', + name : 'confirmNewPassword', + id : 'confirmNewPassword', + width : 250, + allowBlank : false, + blankText : '请输入确认新密码!', + msgTarget : 'side' + }, { + xtype : 'textfield', + fieldLabel : '确认新密码', + inputType : 'password', + name : 'confirmNewPassword', + id : 'confirmNewPassword', + width : 250, + allowBlank : false, + blankText : '请输入确认新密码!', + msgTarget : 'side' + }, { + 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', + value: msg + }] + }] + }], + + buttons : [{ + id : 'saveBtn', + text : '确认', + handler : save + }, { + text : '取消', + handler : function(){top.Ext.getCmp('modifyPWDWindow').close();} + }] + }); + + function save() { + if (!formObj.form.isValid()) { + top.Ext.MessageBox.show({ + title : '错误提示', + msg : '请正确填写表单各值。', + buttons : top.Ext.Msg.OK, + icon : top.Ext.Msg.ERROR + }); + return false; + } + var checkPasswordResult = testPasswordReg(top.Ext.getCmp('newPassword').getValue(),userNameID) + if (!checkPasswordResult.success) { + top.Ext.MessageBox.show({ + title : '错误提示', + msg : checkPasswordResult.msg, + buttons : top.Ext.Msg.OK, + icon : top.Ext.Msg.ERROR + }); + return false; + } + if (top.Ext.getCmp('newPassword').getValue() != Ext + .getCmp('confirmNewPassword').getValue()) { + top.Ext.MessageBox.show({ + title : '错误提示', + msg : '新密码与确认新密码不一致,请重新填写!', + buttons : top.Ext.Msg.OK, + icon : top.Ext.Msg.ERROR + }); + return false; + } + formObj.form.submit({ + url : WWWROOT + '/personalSetting/modifyPWDByExt/save.do', + method : 'POST', + waitMsg : '正在修改密码,请稍候', + waitTitle : '修改密码', + success : function(form, action) { + if (action.result && action.result.success) { + var confirmPwd = top.Ext.getCmp('newPassword').getValue() + var encryptedPassword = encrypt.encrypt(confirmPwd); + sessionStorage.setItem('loginPassword',encryptedPassword); + sessionStorage.setItem('loginUserName',encryptedUserName); + document.loginForm.j_password.value = encryptedPassword; + document.loginForm.submit(); + } else { + top.Ext.MessageBox.show({ + title : '错误提示', + msg : '修改密码失败!', + buttons : top.Ext.Msg.OK, + icon : top.Ext.Msg.ERROR + }); + } + }, + failure : function(form, action) { + if(action.result && action.result.message){ + alert(action.result.message); + }else{ + top.Ext.MessageBox.show({title:'错误提示', msg:'修改密码失败!',buttons:top.Ext.Msg.OK,icon:top.Ext.Msg.ERROR}); + } + } + }); + } + + var window = new top.Ext.Window( { + id : 'modifyPWDWindow', + layout : 'fit', + title : '修改密码', + width : 440, + height : 190, + modal : true, + border : false, + plain : true, + modal:true, + closeAction:'close', + items : [ formObj ] + }); + + window.show(); + top.Ext.getCmp("oldPassword").focus(false, 100); + if(msg !== ''){ + top.Ext.getCmp('showPwdMessage').el.dom.style.color = 'red'; + } + var inputUserName = j_username_display.value; + var encryptedUserName = encrypt.encrypt(inputUserName); + top.Ext.getCmp("userName").setValue(encryptedUserName); +} + if(sstsConfig.enableForgotPasswordFunction){ document.getElementById('forgetPwd').style.display = 'block'; } @@ -514,10 +689,37 @@ return } - document.loginForm.submit(); + needModifyPwd(); hideBox3(); } +//GZSZYY-121:强制修改密码 +function needModifyPwd(){ + if(sstsConfig.needForceModifyPwdWhenFirstTime || sstsConfig.forceUserChangePwdWhenNotMeetPwdComplexityReq){ + var loginPassword = sessionStorage.getItem('loginPassword') || ''; + var loginUserName = sessionStorage.getItem('loginUserName') || ''; + $.ajax({ + type:'post', + dataType:'json', + url : '${ctx}/systemmanage/user/userAction!isModifiedPwdByUser.do', + data:{ + "password":loginPassword, + "userName":loginUserName + }, + success : function(result) { + if(!result){ + showModifyPWDWindowByUnmodified(); + }else { + showResult('修改成功') + document.loginForm.submit(); + } + } + }); + }else { + document.loginForm.submit(); + } +} + //得到随机的颜色值 function randomColor() { var r = Math.floor(Math.random() * 256); @@ -727,10 +929,6 @@ }); } -function submitForm(){ - document.loginForm.submit(); -} - function resetForm(){ document.getElementById("j_username_display").value = ""; document.getElementById("j_password_display").value = ""; @@ -822,7 +1020,7 @@ if(sstsConfig.loginTwoFactorAuthenticationType == 1){ alertBox3() }else { - document.loginForm.submit(); + needModifyPwd(); } }