|
|
$(function() {
|
|
|
|
|
|
var isOldValid = true;
|
|
|
|
|
|
//清空
|
|
|
$('#btn_clear').click(function () {
|
|
|
$("#newUserPwd").val("");
|
|
|
$("#newReUserPwd").val("");
|
|
|
isOldValid = true;
|
|
|
});
|
|
|
|
|
|
//提交更改
|
|
|
$('#btn_submit').click(function () {
|
|
|
/*if($("#userPwd").val() == ""){
|
|
|
toastr.warning("旧密码不能为空!")
|
|
|
return false;
|
|
|
}
|
|
|
if($("#userPwd").val().length < 8){
|
|
|
toastr.warning("旧密码长度小于8位!")
|
|
|
return false;
|
|
|
}*/
|
|
|
if($("#newUserPwd").val() == ""){
|
|
|
toastr.warning("新密码不能为空!")
|
|
|
return false;
|
|
|
}
|
|
|
if($("#newUserPwd").val().length < 8){
|
|
|
toastr.warning("新密码长度小于8位!")
|
|
|
return false;
|
|
|
}
|
|
|
if($("#newReUserPwd").val() == ""){
|
|
|
toastr.warning("重复密码不能为空!")
|
|
|
return false;
|
|
|
}
|
|
|
if($("#newReUserPwd").val().length < 8){
|
|
|
toastr.warning("重复密码长度小于8位!")
|
|
|
return false;
|
|
|
}
|
|
|
reg=/^(?=.*[a-z])(?=.*\d)[a-zA-Z\d]{8,}$/;
|
|
|
if (!reg.test($("#newUserPwd").val())) {
|
|
|
toastr.warning("密码格式必须包含数字和字母!")
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($("#newReUserPwd").val() != $("#newUserPwd").val() ){
|
|
|
toastr.warning("重复密码与密码不一致!")
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: "post",
|
|
|
url: path+"/user/updatePassword",
|
|
|
data:{userPwd : $("#newUserPwd").val()},
|
|
|
dataType:'json',
|
|
|
success: function(data){
|
|
|
if(data.extend.result){
|
|
|
toastr.success("修改成功!");
|
|
|
setTimeout(function(){
|
|
|
window.location.reload();
|
|
|
},1000)
|
|
|
}else{
|
|
|
toastr.error("修改失败!");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/*//验证旧密码
|
|
|
$('#userPwd').blur(function () {
|
|
|
$.ajax({
|
|
|
type: "post",
|
|
|
url: path+"/user/updatePassword",
|
|
|
data:{userPwd : $("#userPwd").val()},
|
|
|
async:false,
|
|
|
success: function(data){
|
|
|
if( ! data.extend.result){
|
|
|
toastr.warning("旧密码输入错误!");
|
|
|
isOldValid = false;
|
|
|
}else{
|
|
|
isOldValid = true;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
})*/
|
|
|
}); |