tom
2023-12-06 9e968679ed2e6937aeb7b50a6c450d5d19251f42
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
    <title>修改密码</title>
    <link href="../../css/common.css" rel="stylesheet" type="text/css">
    <link href="../../css/control.css" rel="stylesheet" type="text/css">
    <script src="../../js/vue/vue.js"></script>
    <script src="../../js/myelement.js?v=20220425"></script>
    <script src="../../js/vue/page.js?v=20220425"></script>
    <script src="../../data/data.js?v=20220425"></script>
 
    <script src="../../js/jquery-3.5.1.min.js"></script>
    <style type="text/css">
        input {
                border-radius: 4px;
                border-color: #C0C4CC;
        }
        input:active {
                border-color: #66b1ff;
        }
        ._button {
            width: 100px;
            height: 25px;
            font: 12px 微软雅黑;
            text-align: center;
            cursor: pointer;
            vertical-align: middle;
            background-color: #409EFF;
            border: hidden;
            color: #fff;
            border-radius: 4px;
        }
        ._button:hover {
            background-color: #66b1ff;
        }
    </style>
        
    <script type="text/javascript" >
        var password, password1, password2;
        var lbl_pass, lbl_pass2;
    
        function cancel() {
            Root.hidePopup();
        }
    
        function changepass() {
            var pass = password.val();
            var pass1 = password1.val();
            var pass2 = password2.val();
            
            var f = validOriginal(pass);
            if(!f) {
                return;
            }
            f = validPassword(pass1);
            if(!f) {
                return;
            }
            
            f = validConfirm(pass2);
            if(!f) {
                return;
            }
 
             let param_ = {
                 passWord: pass,
                 newPassWord: pass1,
                id:localStorage.getItem("id")
             }
             
             Server.call("root/client/changePassword", param_, function(result_) {
                 console.log(result_);
                 if (result_ && result_.success) {
                     Root.message({
                         type: 'success',
                         message: '密码修改成功'
                     });
                    Root.hidePopup();
                 }
             });
             /*var url = "root/user/changepassword?pass=" + pass1;
             $.post(url,    {},
                function(data){
                    if(data.success) {
                        Dialog.alert("密码修改成功");
                    }
                    else {
                        Dialog.alert("密码修改失败!");
                    }
                },
                "json"
            ); */
        }
        
        function validOriginal(value) {
            var pass = localStorage.getItem("password");//window.parent.user.password;
            if(value != pass) {
                lbl_pass.html("原始密码错误");
                return false;
            }else{
                lbl_pass.html("");
                return true;
            }
        }
        
        function validPassword(value) {
            var pwdRegex  =  new RegExp("(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}");
            if (!pwdRegex.test(value)){
                lbl_pass1.html("需包含大小写及特殊符号");
                return false;
            }else{
                lbl_pass1.html("");
                return true;
            }
        }
        
        function validConfirm(value) {
            var pass = password1.val();
            if(value != pass) {
                lbl_pass2.html("确认密码错误");
                return false;
            }else{
                lbl_pass2.html("");
                return true;
            }
        }
        
        $(function(){
            password = $("#edt_pass");
            lbl_pass = $("#lbl_pass");
            password1 = $("#edt_pass1");
            password2 = $("#edt_pass2");
            lbl_pass2 = $("#lbl_pass2");
            lbl_pass1 = $("#lbl_pass1");
            
            /* Win.onShow(function() {
                password.val("");
                password1.val("");
                password2.val("");
                lbl_pass.html("");
                lbl_pass1.html("");
                lbl_pass2.html("");
            }) */
        });
    </script>    
</head>
<body>
    <div style="height:45px; font-size: 24px; text-align: center; line-height: 45px; font-weight: bold">更换密码</div>
    <div style='margin-top: 40px'>
        <div align="right" style="float: left; width: 130px; font: 15px 微软雅黑">旧密码:</div>
        <div style="float: left;">
            <input onblur="validOriginal(this.value);" id="edt_pass" size="20" type="password" style="width: 200px; font-size: 17px"/>
        </div>
        <label id='lbl_pass' style='float:left; margin-left: 5px; font: 12px 微软雅黑; color: red'></label>
        <div style="clear: both; "></div>
        <div align="right" style="float: left; width: 130px; font: 15px 微软雅黑;  margin-top: 15px;">新密码:</div>
        <div style="float: left; margin-top: 15px;">
            <input onblur="validPassword(this.value);" id="edt_pass1" size="20" type="password" style="width: 200px; font-size: 17px"/>
        </div>
        <label id='lbl_pass1' style='float:left; margin-left: 5px; font: 12px 微软雅黑; color: red; margin-top: 15px;'></label>
        <div style="clear: both; "></div>
        <div align="right" style="float: left; width: 130px; font: 15px 微软雅黑; margin-top: 15px">确认密码:</div>
        <div style="float: left; margin-top: 15px;">
            <input onblur="validConfirm(this.value);" id="edt_pass2" size="20" type="password" style="width: 200px; font-size: 17px"/>
        </div>
        <label id='lbl_pass2' style='float:left; margin-left: 5px; font: 12px 微软雅黑; color: red; margin-top: 15px;'></label>                
    </div>
    <div style="clear: both; "></div>
    <div align="center" style="margin-top: 40px;">
        <button class="_button" onclick="changepass();" style="margin: 0px 10px">保存</button>
        <button class="_button" onclick="cancel();" style="margin: 0px 10px">退出</button>
    </div>            
</body>
</html>