username@email.com
2023-02-28 67a0042c5f29e4bb0e0b82f6190f2bc51480b45c
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
@{
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}
 
<div class="wrapper wrapper-content" style="padding: 15px;">
    <div class="row" name="rowSysCode0" label="修改密码" item="SysCode" control="panel">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5><i class="fa fa-list"></i>&nbsp;修改密码</h5>
                <div class="ibox-tools"> <a class="collapse-link" onclick="collapseBox(this);"><i class="fa fa-chevron-up" title="折叠/展开明细"></i></a>&nbsp;&nbsp;                        </div>
            </div>
            <div id="div_content" class="ibox-content">
                <div class="row">
                    <div class="clearfix layer-area" style="padding-bottom:15px;">
                        <label class="text-right col-sm-2 col-md-2 col-sm-offset-1 col-md-offset-1 control-label">原密码<i class="red" style="color:Red;">*</i></label>    <div class="col-sm-4 col-md-4" style="padding-left: 0px;"><input id="txtOldPwd" class="form-control" label="" name="txtOldPwd" labtype="txt" addvisible="true" editvisible="true" reg="" ismust="true" type="password" value="" onblur="validateOldPwd(this);" onkeyup="validateOldPwd(this);"><label onmouseover="activeLab(this);" onmouseout="deactiveLab(this);" onmousedown="showPwd(event, this);" onmouseup="hidePwd(event, this);"><i1></i1><i2 style="display:none;"></i2></label></div><div class="col-sm-5 col-md-5" style="padding-left: 0px; margin-top: 8px; color: red;"><label id="oldPwdPromptText"></label></div>
                    </div>
                    <div class="clearfix layer-area" style="padding-bottom:15px;">
                        <label class="text-right col-sm-2 col-md-2 col-sm-offset-1 col-md-offset-1 control-label">新密码<i class="red" style="color:Red;">*</i></label>    <div class="col-sm-4 col-md-4" style="padding-left: 0px;"><input id="txtNewPwd" class="form-control" label="" name="txtNewPwd" labtype="txt" addvisible="true" editvisible="true" reg="" ismust="true" type="password" value="" onkeyup="validateNewPwd(this);"><label onmouseover="activeLab(this);" onmouseout="deactiveLab(this);" onmousedown="showPwd(event, this);" onmouseup="hidePwd(event, this);"><i1></i1><i2 style="display:none;"></i2></label></div><div id="newPwdPromptText" class="col-sm-5 col-md-5" style="padding-left: 0px;">
                            <div id="lowStronge" class="prompt-bar prompt-bar-default">低</div>
                            <div id="middleStronge" class="prompt-bar prompt-bar-default">中</div>
                            <div id="higeStronge" class="prompt-bar prompt-bar-default">高</div>
                        </div>
                    </div>
                    <div class="clearfix layer-area" style="padding-bottom:10px;">
                        <label class="text-right col-sm-2 col-md-2 col-sm-offset-1 col-md-offset-1 control-label">确认密码<i class="red" style="color:Red;">*</i></label>    <div class="col-sm-4 col-md-4" style="padding-left: 0px;"><input id="txtReNewPwd" class="form-control" label="" name="txtReNewPwd" labtype="txt" addvisible="true" editvisible="true" reg="" ismust="true" type="password" value="" onkeyup="validateNewPwd(this);"><label onmouseover="activeLab(this);" onmouseout="deactiveLab(this);" onmousedown="showPwd(event, this);" onmouseup="hidePwd(event, this);"><i1></i1><i2 style="display:none;"></i2></label></div><div class="col-sm-5 col-md-5" style="padding-left: 0px; margin-top: 8px; color: red;"><label id="reNewPwdPromptText"></label></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="ibox-content" id="top" style="z-index:100; position:fixed; height:50px; width:100%; left: 0; bottom:0;text-align: right; padding-top:8px ">
    <div id="divButtonsPanel" class="" style="float:right;" data-bootstro-width="500px">
        <a id="linkSave" style="" class="btn btn-success" href="javascript:void(0)" onclick="savePassword();"><i class="glyphicon glyphicon-ok"></i>&nbsp;&nbsp;<span class="bold">提交</span></a>
    </div>
    <div class="bootstro" style="float:left; width:400px;height:40px" id="divexam" data-bootstro-width="500px" data-bootstro-content="当前业务单据基础信息:单据类型,申请人,单据状态,当前节点,当前节点审批人">
    </div>
    <div class="bootstro" style="float:left; margin-left:50px; height:40px;width:200px;  border:0px solid aquamarine ; overflow:auto" id="divcomment" data-bootstro-content="当前业务单据操作说明"></div>
</div>
 
@section headerStyle{
    <style type="text/css">
        div.clearfix > label {
            padding-top: 8px;
        }
 
        input[type="password"] {
            padding-right: 40px;
        }
 
        i1:before {
            content: "\f070";
            color: #aaa;
            font-size: 22px;
            font-family: FontAwesome;
            position: absolute;
            right: 25px;
            top: 2px;
        }
 
        i2:before {
            content: "\f070";
            color: #000;
            font-size: 22px;
            font-family: FontAwesome;
            position: absolute;
            right: 25px;
            top: 2px;
        }
 
        .prompt-bar {
            width: 20%;
            height: 25px;
            margin: 5px 2px;
            padding-top: 4px;
            float: left;
            text-align: center;
        }
 
        .prompt-bar-default {
            background-color: #F6F6FA;
            color: #AAAAAA;
        }
 
        .prompt-bar-low {
            background-color: #FF4B47;
            color: #FFF;
        }
 
        .prompt-bar-middle {
            background-color: #F9AE35;
            color: #FFF;
        }
 
        .prompt-bar-high {
            background-color: #2DAF7D;
            color: #FFF;
        }
    </style>
}
 
@section footerScripts {
    <script type="text/javascript">
    $(function () {
        var hh = document.body.clientHeight - $("#top").height() - 142;
        $(".tree, #div_content").height(hh);
    });
 
    // 保存密码
    var savePassword = function () {
        var oldPwd = $('#txtOldPwd').val();
        var newPwd = $('#txtNewPwd').val();
        var reNewPwd = $('#txtReNewPwd').val();
        if (oldPwd == "") {
            toastr.warning("请填写原密码");
            return;
        }
        if (Verify.strShortLength(oldPwd)) {
            msg.warn("原密码超长");
            return;
        }
        if (newPwd == "") {
            toastr.warning("请填写新密码");
            return;
        }
        if (Verify.strShortLength(newPwd)) {
            msg.warn("新密码超长");
            return;
        }
        if (reNewPwd == "") {
            msg.warn("请填写确认密码");
            return;
        }
        if (Verify.strShortLength(reNewPwd)) {
            msg.warn("确认密码超长");
            return;
        }
        if (newPwd != reNewPwd) {
            msg.warn("两次密码不一致");
            return;
        }
        $.ajax({
            type: "POST",
            url: "/Home/ChangePassword",
            dataType: "json",
            data: { oldPwd: oldPwd, newPwd: newPwd },
            success: function (data) {
                if (data) {
                    if (data.Result) {
                        toastr.success(data.Message);
                    } else {
                        toastr.warning(data.Message);
                    }
                }
            },
            error: function () {
                toastr.error("保存失败");
            }
        });
    }
 
    // 激活查看密码
    var activeLab = function (dom) {
        $(dom).children('i1').hide();
        $(dom).children('i2').show();
    }
 
    // 取消查看密码
    var deactiveLab = function (dom) {
        $(dom).children('i1').show();
        $(dom).children('i2').hide();
        $(dom).siblings('input').attr('type', 'password');
    }
 
    // 显示密码
    var showPwd = function (e, dom) {
        if (e.button == 0)
            $(dom).siblings('input').attr('type', 'text');
    }
 
    // 隐藏密码
    var hidePwd = function (e, dom) {
        if (e.button == 0)
            $(dom).siblings('input').attr('type', 'password');
    }
 
    // 验证原密码
    var validateOldPwd = function (dom) {
        var oldPwd = $(dom).val();
        if (oldPwd == "") {
            $('#oldPwdPromptText').text("请填写原密码");
        } else {
            $('#oldPwdPromptText').text('');
        }
    }
 
    // 验证新密码
    var validateNewPwd = function (dom) {
        var newPwd = $('#txtNewPwd').val();
        var reNewPwd = $('#txtReNewPwd').val();
        if (newPwd == "" && reNewPwd == "") {
            $('#reNewPwdPromptText').text('');
        } else {
            if (newPwd !== reNewPwd) {
                $('#reNewPwdPromptText').text('两次密码不一致');
            } else {
                $('#reNewPwdPromptText').text('');
            }
        }
        if ($(dom).attr('id') == 'txtNewPwd') {
            validateNewPwdStronge(newPwd);
        }
    }
 
    // 验证密码强度
    var validateNewPwdStronge = function (newPwd) {
        if (newPwd.length == 0) {
            $('#lowStronge').removeClass('prompt-bar-low').addClass('prompt-bar-default');
            $('#middleStronge').removeClass('prompt-bar-middle').addClass('prompt-bar-default');
            $('#higeStronge').removeClass('prompt-bar-high').addClass('prompt-bar-default');
        } else if (newPwd.length > 0 && newPwd.length < 6) {
            $('#lowStronge').removeClass('prompt-bar-default').addClass('prompt-bar-low');
            $('#middleStronge').removeClass('prompt-bar-middle').addClass('prompt-bar-default');
            $('#higeStronge').removeClass('prompt-bar-high').addClass('prompt-bar-default');
        } else {
            $('#lowStronge').removeClass('prompt-bar-default').addClass('prompt-bar-low');
            $('#middleStronge').removeClass('prompt-bar-default').addClass('prompt-bar-middle');
            var reg = /\W/;
            var count = 0;
            for (var i = 0, len = newPwd.length; i < len; i++) {
                if (reg.test(newPwd[i])) {
                    if (++count >= 2) {
                        break;
                    }
                }
            }
            if (count >= 2) {
                $('#higeStronge').removeClass('prompt-bar-default').addClass('prompt-bar-high');
            } else {
                $('#higeStronge').removeClass('prompt-bar-high').addClass('prompt-bar-default');
            }
        }
    }
    </script>
}