|  |  | 
 |  |  |     <meta name="renderer" content="webkit"> | 
 |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
 |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
 |  |  |     <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../static/layui/css/layui.css" media="all"> | 
 |  |  |     <style> | 
 |  |  |         #password-div { | 
 |  |  |             padding: 20px 20px 20px 13px; | 
 |  |  | 
 |  |  |         <div class="layui-form-item"> | 
 |  |  |             <label class="layui-form-label">当前密码</label> | 
 |  |  |             <div class="layui-input-inline"> | 
 |  |  |                 <input id="oldPassword" type="password" class="layui-input" lay-verify="checkPwd" lay-vertype="tips"> | 
 |  |  |                 <input id="oldPassword" type="password" class="layui-input" lay-verify="checkPwd" lay-vertype="tips" autocomplete="off"> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div class="layui-form-item"> | 
 |  |  | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  | </body> | 
 |  |  | <script type="text/javascript" src="/static/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script src="/static/layui/layui.js"></script> | 
 |  |  | <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script type="text/javascript" src="../static/js/tools/md5.js"></script> | 
 |  |  | <script type="text/javascript" src="../static/js/common.js" charset="utf-8"></script> | 
 |  |  | <script src="../static/layui/layui.js"></script> | 
 |  |  | <script> | 
 |  |  |     layui.use(['form'], function() { | 
 |  |  |         var form = layui.form, | 
 |  |  | 
 |  |  |         form.verify({ | 
 |  |  |             checkPwd: function(val) { | 
 |  |  |                 if (val === ""){ | 
 |  |  |                     return "当前密码不能为空"; | 
 |  |  |                     // return "当前密码不能为空"; | 
 |  |  |                 } | 
 |  |  |                 if (parent.$('#password').val() !== val) { | 
 |  |  |                 if (parent.$('#password').val() !== hex_md5(val)) { | 
 |  |  |                     return "密码不匹配"; | 
 |  |  |                 } | 
 |  |  |             }, | 
 |  |  | 
 |  |  |                 if (val.length < 4) { | 
 |  |  |                     return "不能少于4个字符"; | 
 |  |  |                 } | 
 |  |  |                 if (parent.$('#password').val() === val) { | 
 |  |  |                 if (parent.$('#password').val() === hex_md5(val)) { | 
 |  |  |                     return "与旧密码不能相同"; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 let username = localStorage.getItem('username') | 
 |  |  |                 if (!(username === 'super' || password === 'root')){ | 
 |  |  |                     if(!checkPassword(val)){ | 
 |  |  |                         //密码必须包含字符和数字 | 
 |  |  |                         return "密码必须包含字符和数字长度不能少于8位,且不能包含连续数字和四位重复数字"; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }, | 
 |  |  |             rePwd: function (val) { | 
 |  |  |                 if ($('#password').val() !== val){ | 
 |  |  |                     return "密码不一致"; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 let username = localStorage.getItem('username') | 
 |  |  |                 if (!(username === 'super' || password === 'root')){ | 
 |  |  |                     if(!checkPassword(val)){ | 
 |  |  |                         //密码必须包含字符和数字 | 
 |  |  |                         return "密码必须包含字符和数字长度不能少于8位,且不能包含连续数字和四位重复数字"; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  | 
 |  |  |         form.on('submit(savePwd)', function (data) { | 
 |  |  |             var user = { | 
 |  |  |                 id: parent.$('#id').val(), | 
 |  |  |                 password: $('#password').val(), | 
 |  |  |                 password: hex_md5($('#password').val()), | 
 |  |  |             }; | 
 |  |  |             $.ajax({ | 
 |  |  |                 url: "/user/update/auth", | 
 |  |  |                 url: baseUrl+"/user/update/auth", | 
 |  |  |                 headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                 data: user, | 
 |  |  |                 method: 'POST', | 
 |  |  | 
 |  |  |                             btn: ['确定'], | 
 |  |  |                             btn1: function(){ | 
 |  |  |                                 localStorage.removeItem("token"); | 
 |  |  |                                 top.location.href = "/"; | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             }, | 
 |  |  |                             cancel: function(){ | 
 |  |  |                                 localStorage.removeItem("token"); | 
 |  |  |                                 top.location.href = "/"; | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             }, | 
 |  |  |                             closeBtn: 0, | 
 |  |  |                             shadeClose: false, | 
 |  |  |                         }) | 
 |  |  |                     } else if (res.code === 403){ | 
 |  |  |                         top.location.href = "/"; | 
 |  |  |                         top.location.href = baseUrl+"/"; | 
 |  |  |                     } else { | 
 |  |  |                         layer.msg(res.msg); | 
 |  |  |                     } |