2020-08-21更新版本

master
zengwh 5 years ago
parent 5d20861895
commit 5f8291e2a8

@ -28,7 +28,7 @@
<div class="form-group">
<label for="newUserPwd" class="col-sm-2 control-label">密码</label>
<div class="col-sm-5">
<input type="password" class="form-control" id="newUserPwd" name="newUserPwd" onblur="AnalyzePasswordSecurityLevel('newUserPwd')"
<input type="password" class="form-control" id="newUserPwd" name="newUserPwd"
placeholder="请输入新密码" maxlength="16">
</div>
<div id="newUserPwdText" class="col-sm-2" style="color: red">
@ -38,7 +38,7 @@
<div class="form-group">
<label for="newReUserPwd" class="col-sm-2 control-label">重复密码</label>
<div class="col-sm-5">
<input type="password" class="form-control" id="newReUserPwd" onblur="AnalyzePasswordSecurityLevel('newReUserPwd')"
<input type="password" class="form-control" id="newReUserPwd"
placeholder="请输入重复密码" maxlength="16">
</div>
<div id="newReUserPwdText" class="col-sm-2" style="color: red">
@ -55,5 +55,5 @@
</form>
</form>
</body>
<script src="${path}/static/js/updatePassword.js?t=1"></script>
<script src="${path}/static/js/updatePassword.js?time=2020-08-26"></script>
</html>

@ -1,24 +1,66 @@
$(function() {
var isOldValid = true;
//清空
$('#btn_clear').click(function () {
$("#newUserPwd").val("");
$("#newReUserPwd").val("");
isOldValid = true;
});
//提交更改
$('#btn_submit').click(function () {
/*if($("#userPwd").val() == ""){
if($("#userPwd").val() == ""){
toastr.warning("旧密码不能为空!")
return false;
}
if($("#newUserPwd").val() == ""){
toastr.warning("新密码不能为空!")
return false;
}
if($("#newReUserPwd").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("修改失败!");
}
}
});
});
});
/*
$(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;
@ -40,14 +82,10 @@ $(function() {
toastr.warning("密码格式必须包含数字和字母!")
return false;
}
if($("#newReUserPwd").val() != $("#newUserPwd").val() ){
toastr.warning("重复密码与密码不一致!")
return false;
}
$.ajax({
type: "post",
url: path+"/user/updatePassword",
@ -65,37 +103,15 @@ $(function() {
}
});
});
/*//验证旧密码
$('#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;
}
}
});
})*/
});
/**
/!**
* 密码强度动态验证
* @param passName
* @constructor
*/
*!/
function AnalyzePasswordSecurityLevel(passName) {
debugger
var password =$("#"+passName).val();
var pwdArray = new Array();
var securityLevelFlag = 0;
if (passName == "newReUserPwd") {
if(password == $("#newUserPwd").val()){
@ -132,7 +148,6 @@ function AnalyzePasswordSecurityLevel(passName) {
securityLevelFlag++;
}
}
if (passName == "newUserPwd"){
if (securityLevelFlag == 1){
$("#newUserPwdText").text("");
@ -231,4 +246,4 @@ function AnalyzePasswordSecurityLevel(passName) {
}
}
}
}
}*/

Loading…
Cancel
Save