Index: ssts-web/src/main/webapp/logon.jsp =================================================================== diff -u -r31390 -r31643 --- ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 31390) +++ ssts-web/src/main/webapp/logon.jsp (.../logon.jsp) (revision 31643) @@ -119,8 +119,11 @@ 消毒供应质量追溯管理系统 + + + + - + + + +
@@ -154,6 +282,9 @@ +
+ 忘记密码? +
@@ -182,6 +313,10 @@ }) } +if(sstsConfig.enableForgotPasswordFunction){ + document.getElementById('forgetPwd').style.display = 'block'; +} + if (top != self) { top.location = self.location; } @@ -228,6 +363,170 @@ if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } +//弹出验证码的窗口 +var ab1,ab2; +function alertBox1(userName,phoneNumber){ + ab1 = new AlertBox("idBox1",{ + 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('idBox1').style.left = left + 'px'; + document.getElementById('idBox1').style.top = top + 'px'; + + document.getElementById('userName').value = userName; + document.getElementById('userPhone').value = phoneNumber; + } + }); + ab1.show(); +} + +//关闭验证码的窗口 +function hideBox1(){ + ab1.close(); +} + +//关闭重置密码的窗口 +function hideBox2(){ + ab2.close(); +} + +//忘记密码 +function forgetPassword(){ + var userName = document.getElementById("j_username_display").value; + if(userName == ''){ + alert('请输入用户名'); + }else { + isBindPhone(userName); + } +} + +//下一步 +function next(){ + var hiddenUserCode = document.getElementById('hiddenUserCode').value; + var userCode = document.getElementById('userCode').value; + if(hiddenUserCode !== userCode){ + alert('验证码不正确'); + return; + } + ab1.close(); + ab2 = new AlertBox("idBox2",{ + 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('idBox2').style.left = left + 'px'; + document.getElementById('idBox2').style.top = top + 'px'; + } + }); + ab2.show(); +} + +//重置密码 +function resetPassword(){ + var userName = document.getElementById("j_username_display").value; + var newPwd = document.getElementById('newPwd').value; + var confirmPwd = document.getElementById('confirmPwd').value; + if(newPwd !== confirmPwd){ + alert('两次输入的密码不一致'); + return + } + var checkPasswordResult = testPasswordReg(newPwd, userName); + if(!checkPasswordResult.success){ + alert(checkPasswordResult.msg); + return false; + } + $.ajax({ + type:'post', + dataType:'json', + url : '${ctx}/disinfectSystem/verification/verificationCodeAction!modifyPassword.do', + data:{ + 'loginName':userName, + 'newPassword':confirmPwd + }, + success : function(result) { + if(result.success){ + alert('重置成功'); + ab2.close(); + }else { + alert(result.message); + } + } + }); +} + +var time = 60; +//发送验证码 +function sendCode(that){ + var userName = document.getElementById("j_username_display").value; + if(userName == ''){ + alert('用户名不存在'); + return; + } + $.ajax({ + type:'post', + dataType:'json', + url : '${ctx}/disinfectSystem/verification/verificationCodeAction!generateverificationCode.do', + data:{ + "loginName":userName + }, + success : function(result) { + if(result.success){ + document.getElementById('hiddenUserCode').value = result.verificationCode; + that.innerHTML = time + ' s'; + that.disabled = true; + setCodeTimeout(that); + }else { + alert(result.message); + document.getElementById('hiddenUserCode').value = ''; + } + } + }); +} + +//倒计时 +function setCodeTimeout(that){ + var t = setTimeout(function() { + if(time > 0){ + time--; + that.innerHTML = time + ' s'; + setCodeTimeout(that); + }else { + clearTimeout(t); + time = 60; + that.disabled = false; + that.innerHTML = '发送验证码'; + } + }, 1000); +} + +//验证是否绑定手机号 +function isBindPhone(userName){ + $.ajax({ + type:'post', + dataType:'json', + url : '${ctx}/disinfectSystem/verification/verificationCodeAction!getPhoneNumberByLoginName.do', + data:{ + "loginName":userName + }, + success : function(result) { + if(result.success){ + alertBox1(userName,result.phoneNumber); + }else { + alert(result.message); + } + } + }); +} + /** * 退出登录 */