-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetPsw.html
101 lines (99 loc) · 3.58 KB
/
resetPsw.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>修改密码</title>
<link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
<link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
<link rel="stylesheet" href="css/plugins/sweetalert/sweetalert2.css">
<link rel="stylesheet" href="css/bootstrap-table.css">
</head>
<style>
.middle-box{
max-width: 400px;
}
</style>
<body>
<div class="container middle-box">
<div class="row">
<form role="form" class="form-horizontal" id="form">
<div class="form-group">
<label class="control-label col-sm-4">原密码:</label>
<div class="col-sm-8"><input id="oldPassword"name="oldPassword" type="password" class="form-control" required></div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">新密码:</label>
<div class="col-sm-8"><input id="newPassword"name="newPassword" type="password" class="form-control" required></div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">确认密码:</label>
<div class="col-sm-8"><input id="confirm_psw" name="confirm_psw" type="password" class="form-control" required></div>
</div>
<button type="button" class="btn btn-primary col-sm-offset-7" onclick="save()">确定</button>
</form>
</div>
</div>
<script src="lib/jquery.min.js?v=2.1.4"></script>
<script src="lib/bootstrap.min.js?v=3.3.6"></script>
<script src="lib/plugins/validate/jquery.validate.min.js"></script>
<script src="lib/plugins/validate/messages_zh.min.js"></script>
<script src="js/publicUrl.js"></script>
<script src="lib/plugins/sweetalert/sweetalert2.js"></script>
<script>
$(function () {
let icon = "<i class='fa fa-times-circle'></i> ";
$("#form").validate({
rules:{
confirm_psw:{
required:true,
equalTo:"#newPassword"
}
},
messages:{
confirm_psw:{
equalTo:icon+"两次输入的密码不一致"
}
}
})
});
function save() {
if ($("#form").valid()) {
console.log(sessionStorage.getItem("workNum"));
console.log($("#newPassword").val());
$.ajax({
url:url+"WebMainServlet",
dataType:"json",
type: 'post',
data:{
method:"modifyPassword",
username: sessionStorage.getItem("username"),
originPwd:sessionStorage.getItem("password"),
newPwd:$("#newPassword").val()
},
success:function (data) {
if(data.code===1){
swal(
data.msg,
'',
'info'
);
}
else if (data.code === 0) {
swal(
'修改成功',
'',
'success'
).then(function(isConfirm) {
if (isConfirm) {
window.parent.location.href="login.html"
}
});
}
},
})
}
}
</script>
</body>
</html>