loginStatus();//判断个人是否登录 /** * 邮箱找回密码第三步 */ $(function (){ //var _widht = document.documentElement.clientWidth; //屏幕宽 var _height = document.documentElement.clientHeight; //屏幕高 //var boxWidth = $(".email-find3").width(); var boxHeight = $(".email-find3").height(); $(".email-find3").css({top: (_height - boxHeight) / 2 +"px"}); //输入密码及确认密码获取 var oldPass = false; var isPass = false; //校验第一个密码 $("#mail_password").blur(function(){ valOld(); }) //校验确认密码 $("#mail_password1").blur(function(){ valNew(); }) //提交重置密码 $("#reset_password").click(function(){ resetPassword(); }); }); function valOld() { var newPassword = $("#mail_password").val(); if(newPassword.length==0) { $(".msg1 span").text("密码不能为空"); oldPass = false; }else if(newPassword.length < 6) { $(".msg1 span").text("密码不少于6位,请输入正确的密码"); }else { $(".msg1 span").text(""); oldPass = true; } } function valNew() { var newPassword = $("#mail_password").val(); var oldPassword = $("#mail_password1").val(); if(oldPassword.length==0) { $(".msg2 span").text("密码不能为空"); } else if(oldPassword.length<6) { $(".msg2 span").text("密码长度过短,至少六位"); }else if(oldPassword != newPassword) { $(".msg2 span").text("两次密码不一致"); } else { isPass = true; $(".msg2 span").text(""); } } function resetPassword() { valOld(); valNew(); var mailCode = GetQueryString('sc'); var oldPassword = $("#mail_password1").val(); $.ajax("/ajax/resetPasswordWith",{ type:"post", success:function(data){ // console.log(data); if(data.success){ if(data.data == true){ $.MsgBox.Alert("消息","密码重置成功,3秒后自动调转登录页面!"); $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain'); window.setTimeout(function(){ location.href="login.html"; }, 3000); }else{ $(".msg3").text("设置失败,验证码超时"); } }else{ $(".msg2").text("系统异常!"); } }, error:function(){ $.MsgBox.Alert('消息','服务器链接失败') }, data:{"state":mailCode,"pw":oldPassword}, dataType: 'json'} ); }