password encrpt

This commit is contained in:
caoqianming 2019-11-18 19:32:59 +08:00
parent 1a987130cc
commit e63749c8ed
5 changed files with 48 additions and 33 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ mysite/__pycache__/
media/ media/
aspnet_client/ aspnet_client/
static/ static/
mysite/settings.py
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

View File

@ -643,12 +643,13 @@ def exportxlsx(a,objs):
sheet = wb.active sheet = wb.active
for i, x in enumerate(objs): for i, x in enumerate(objs):
num = str(i+3) num = str(i+3)
sheet['a'+num] = x.name sheet['a'+num] = x.num
sheet['b'+num] = x.catename sheet['b'+num] = x.name
sheet['c'+num] = x.type sheet['c'+num] = x.cate.dickeyname
sheet['d'+num] = x.area.name sheet['d'+num] = x.type
sheet['e'+num] = '正常' if x.state==1 else '异常' sheet['e'+num] = x.area.name
sheet['f'+num] = 'https://safeyun.ctcshe.com/miniprogram/equipment?id='+str(x.id) sheet['f'+num] = '正常' if x.state==1 else '异常'
sheet['g'+num] = 'https://safeyun.ctcshe.com/miniprogram/equipment?id='+str(x.id)
nowtime = datetime.now().strftime('%Y%m%d%H%M%S') nowtime = datetime.now().strftime('%Y%m%d%H%M%S')
sheet['b1'] = nowtime sheet['b1'] = nowtime
filename = 'SBS' + nowtime filename = 'SBS' + nowtime

Binary file not shown.

View File

@ -28,12 +28,11 @@
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script> <script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/util.js"></script> <script type="text/javascript" src="/static/safesite/mystatic/js/util.js"></script>
<style type="text/css"> <style type="text/css">
.easyui-linkbutton:hover .easyui-linkbutton:hover {
{
background: #1148a0; background: #1148a0;
color: #0E2D5F; color: #0E2D5F;
} }
.loading { .loading {
position: absolute; position: absolute;
z-index: 1000; z-index: 1000;
@ -45,14 +44,16 @@
text-align: left; text-align: left;
padding: 5px 10px padding: 5px 10px
} }
.northDiv { .northDiv {
overflow: hidden; overflow: hidden;
height: 80px; height: 80px;
background-color: #013162; background-color: #013162;
background-image: url("/static/safesite/mystatic/images/indexbj1.png"); background-image: url("/static/safesite/mystatic/images/indexbj1.png");
background-repeat: no-repeat; background-repeat: no-repeat;
font-family: Verdana, 微软雅黑,黑体 font-family: Verdana, 微软雅黑, 黑体
} }
.divMune { .divMune {
height: 35px; height: 35px;
background-color: #f9f9f9; background-color: #f9f9f9;
@ -62,7 +63,7 @@
font-weight: bold; font-weight: bold;
line-height: 35px; line-height: 35px;
cursor: pointer; cursor: pointer;
} }
</style> </style>
</head> </head>
@ -76,8 +77,9 @@
</div> </div>
<div region="north" class="northDiv"> <div region="north" class="northDiv">
<div style="float:right;width:7%;margin-left:10px"> <div style="float:right;width:7%;margin-left:10px">
<img src="/static/safesite/mystatic/images/head.png" style="float: right;width:50px;height:50px;text-align: center;margin-top: 10px;margin-right: 10px;" <img src="/static/safesite/mystatic/images/head.png"
id="headimg" /> style="float: right;width:50px;height:50px;text-align: center;margin-top: 10px;margin-right: 10px;"
id="headimg" />
</div> </div>
<div style="width:30%;float:right"> <div style="width:30%;float:right">
<div style="margin-top: 10px;text-align: center;position: fixed;width: 500px;height: 70px;right: 20px;"> <div style="margin-top: 10px;text-align: center;position: fixed;width: 500px;height: 70px;right: 20px;">
@ -87,30 +89,35 @@
</div> </div>
<div style="text-align: center;position: fixed;width: 500px;height: 70px;top: 40px;right: 60px;"> <div style="text-align: center;position: fixed;width: 500px;height: 70px;top: 40px;right: 60px;">
<a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-sign-out" plain=true <a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-sign-out" plain=true
onclick="logout()">安全退出</a> onclick="logout()">安全退出</a>
<a style="color: #eee5e7;cursor: pointer;" id="bindwx" class="easyui-linkbutton" iconCls="fa-weixin" plain=true <a style="color: #eee5e7;cursor: pointer;" id="bindwx" class="easyui-linkbutton" iconCls="fa-weixin"
onclick="bindwx()">绑定微信</a> plain=true onclick="bindwx()">绑定微信</a>
<a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-key" plain=true <a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-key" plain=true
onclick="javascript:$('#pwdg').dialog({border:false})">修改密码</a> onclick="javascript:$('#pwdg').dialog({border:false})">修改密码</a>
<a id='setupb' class="easyui-linkbutton" iconCls="fa-cogs" plain=true style="display:none;color: #eee5e7;cursor: pointer;" <a id='setupb' class="easyui-linkbutton" iconCls="fa-cogs" plain=true
onclick="setup()">预警设置</a> style="display:none;color: #eee5e7;cursor: pointer;" onclick="setup()">预警设置</a>
<a style="color: #eee5e7;cursor: pointer;" href="datashow" target="_blank" class="easyui-linkbutton" iconCls="fa-desktop" plain=true>数据大屏</a> <a style="color: #eee5e7;cursor: pointer;" href="datashow" target="_blank" class="easyui-linkbutton"
iconCls="fa-desktop" plain=true>数据大屏</a>
</div> </div>
</div> </div>
<div style="width:50%;height:100%"> <div style="width:50%;height:100%">
<input id="userindex" userid="{{userid}}" openid="{{openid}}" nickname="{{nickname}}" <input id="userindex" userid="{{userid}}" openid="{{openid}}" nickname="{{nickname}}"
headimgurl="{{headimgurl}}" menus="{{menus}}" style="display:none;" /> headimgurl="{{headimgurl}}" menus="{{menus}}" style="display:none;" />
<button style="margin: 15px;background-color: transparent;border: 0;color: white;cursor: pointer;" onclick="javascript:$('#main').panel({href:'mainhtml',title:'主页'})"><span style="font-size:24px">{{companyname}}</span><br/><span style="font-size:20px">安全生产管理系统</span></button> <button style="margin: 15px;background-color: transparent;border: 0;color: white;cursor: pointer;"
onclick="javascript:$('#main').panel({href:'mainhtml',title:'主页'})"><span
style="font-size:24px">{{companyname}}</span><br /><span
style="font-size:20px">安全生产管理系统</span></button>
</div> </div>
</div> </div>
<div id="menuTreediv" data-options="region:'west'" style="width: 150px; background-color: #ffffff;"> <div id="menuTreediv" data-options="region:'west'" style="width: 150px; background-color: #ffffff;">
<div class="divMune"> <div class="divMune">
<img src="/static/safesite/mystatic/images/fanhuiBut.png" style="float: right;width:20px;height:20px;text-align: center;margin-top: 10px;margin-right: 10px;" <img src="/static/safesite/mystatic/images/fanhuiBut.png"
id="headimg" /> style="float: right;width:20px;height:20px;text-align: center;margin-top: 10px;margin-right: 10px;"
id="headimg" />
<a onclick="javascript:$('#main').panel({href:'mainhtml',title:'主页'})">返回主页</a> <a onclick="javascript:$('#main').panel({href:'mainhtml',title:'主页'})">返回主页</a>
</div> </div>
<div id="menuTree" style="width:100%;text-align: right; background-color: rgb(25, 53, 58);"></div> <div id="menuTree" style="width:100%;text-align: right; background-color: rgb(25, 53, 58);"></div>
@ -198,7 +205,11 @@
var v = $("#oldpwd").val(); var v = $("#oldpwd").val();
var v1 = $("#newpwd").val(); var v1 = $("#newpwd").val();
var v2 = $("#newpwd2").val(); var v2 = $("#newpwd2").val();
if (v1 == v2) { var regex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}');
if (!regex.test(v1)||!regex.test(v2)) {
$.messager.alert("提示信息", "您的密码复杂度太低(密码中必须包含字母、数字)", "error");
}
else if (v1 == v2) {
$.post( $.post(
"changepwd", "changepwd",
{ "oldpassword": v, "newpassword": v1 }, { "oldpassword": v, "newpassword": v1 },
@ -221,7 +232,7 @@
} }
function setup() { function setup() {
opendg('预警相关设置','setup?a=setuph') opendg('预警相关设置', 'setup?a=setuph')
} }
/* /*
* 关闭遮罩层 * 关闭遮罩层
@ -252,8 +263,8 @@
}, },
}); });
}) })
$.get('api/rights?a=have',function(res){ $.get('api/rights?a=have', function (res) {
localStorage.setItem('data',JSON.stringify(res)); localStorage.setItem('data', JSON.stringify(res));
}) })
</script> </script>

View File

@ -2219,8 +2219,10 @@ def getuser(req):
if req.GET.get('a')=='datagrid': if req.GET.get('a')=='datagrid':
a = User.objects.filter(ubelongpart__in=parts,deletemark=1).exclude(issuper=1) a = User.objects.filter(ubelongpart__in=parts,deletemark=1).exclude(issuper=1)
total = a.count() total = a.count()
startnum,endnum = fenye(req) if req.GET.get('page',None):
a = a[startnum:endnum].values('userid','empid','name','ubelongpart__partname','ubelongpart__partid','username','openid') startnum,endnum = fenye(req)
a = a[startnum:endnum]
a = a.values('userid','empid','name','ubelongpart__partname','ubelongpart__partid','username','openid')
return HttpResponse(transjson(total,a),content_type="application/json") return HttpResponse(transjson(total,a),content_type="application/json")
else: else:
a = User.objects.filter(ubelongpart__in=parts,deletemark=1).exclude(issuper=1).values('userid','name') a = User.objects.filter(ubelongpart__in=parts,deletemark=1).exclude(issuper=1).values('userid','name')
@ -3149,7 +3151,7 @@ def apicompany(req):
x = User() x = User()
x.username = admin x.username = admin
x.name = '超级管理员' x.name = '超级管理员'
x.password = '0000' x.password = 'Aq123456'
x.issuper = 1 x.issuper = 1
x.ubelongpart = y x.ubelongpart = y
x.usecomp = y x.usecomp = y