| | |
| | | // 详情窗口-宽度 |
| | | var detailWidth = '90%'; |
| | | |
| | | function checkPassword(password) { |
| | | //密码必须包含字符和数字长度不能少于8位 |
| | | let pattern = /(?=.*[0-9])(?=.*[a-zA-Z!@#$]).{8,}/ |
| | | //不能包含连续数字 |
| | | let pattern2 = /(0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){3}\d/ |
| | | //重复数字不能超过四位 |
| | | let pattern3 = /(\d)\1{3}/ |
| | | if (pattern.test(password) && pattern2.test(password) === false && pattern3.test(password) === false) { |
| | | //匹配放行 |
| | | return true |
| | | } |
| | | |
| | | //不匹配要求修改密码 |
| | | return false; |
| | | } |
| | | |
| | | // 非空判断 |
| | | function isEmpty(obj){ |
| | | return typeof obj == "undefined" || obj == null || obj === ""; |
| | |
| | | <cite id="username" style="margin-right: 5px">管理员</cite> |
| | | </a> |
| | | <dl class="layui-nav-child"> |
| | | <dd lay-unselect><a ew-href="detail.html?resourceId=8">基本资料</a></dd> |
| | | <dd lay-unselect><a id="personPage" ew-href="detail.html?resourceId=8">基本资料</a></dd> |
| | | <hr> |
| | | <dd lay-unselect><a id="logout">退出</a></dd> |
| | | </dl> |
| | |
| | | var url = logout.getAttribute('href'); |
| | | logout.setAttribute('href', baseUrl + "/login"); |
| | | |
| | | let username = localStorage.getItem('username') |
| | | let password = localStorage.getItem('password') |
| | | if (!(username === 'super' || password === 'root')) { |
| | | if(!checkPassword(password)){ |
| | | //要求修改密码 |
| | | layer.msg('弱密码请修改密码再继续', {icon: 2}); |
| | | layer.open({ |
| | | type: 2, |
| | | title: '基本资料', |
| | | maxmin: true, |
| | | shadeClose: false, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | content: 'detail.html', |
| | | closeBtn: 0, |
| | | success: function(layero, index){ |
| | | layero.find('.layui-layer-min').remove(); //去掉最小化按钮 |
| | | layero.find('.layui-layer-max').remove(); //去掉最大化按钮 |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }); |
| | | </script> |
| | | <script type="text/html" id="menuTpl"> |
| | |
| | | if (res.code === 200){ |
| | | localStorage.setItem("token", res.data.token); |
| | | localStorage.setItem("username", res.data.username); |
| | | localStorage.setItem("password", password); |
| | | window.location.href = "index.html"; |
| | | } else if (res.code === 10001) { |
| | | layer.tips(res.msg, '#username', {tips: [4, '#ff0000']}); |
| | |
| | | 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位,且不能包含连续数字和四位重复数字"; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |