changepassword.jsp
16.9 KB
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><spring:message code="app.name" /></title>
<jsp:include page="../../layout/inc.jsp"></jsp:include>
<!-- validate 验证中英文 -->
<script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
</head>
<body>
<div class="container">
<div id="pf-hd">
<div class="pf-logo">
<h1 style="font-size:24px;color:white;"><spring:message code="app.name" /></h1>
</div>
<div style="height:70px;line-height: 70px;width: 100px;float: right; ">
<select style="background: #11a9e2;padding: 2px;border: 1px solid #FFF;color:#FFF;" onchange="sLang(this)">
<option value="zh_CN" <c:if test="${pageContext.response.locale=='zh_CN'}">selected</c:if>>中文</option>
<option value="en_US" <c:if test="${pageContext.response.locale=='en_US'}">selected</c:if>>English</option>
</select>
</div>
<div class="pf-user">
<div class="pf-user-photo">
<img src="<%=basePath %>resource/images/main/user.png" alt="">
</div>
<h4 class="pf-user-name ellipsis" style="min-width:32px;">${user.loginaccount}</h4>
<i class="iconfont xiala"></i>
<div class="pf-user-panel">
<ul class="pf-user-opt">
<li class="pf-modify-pwd">
<a href="<%=basePath %>system/user/changepassword">
<i class="iconfont"></i>
<span class="pf-opt-name"> <spring:message code="index.modifyPassword" /></span>
</a>
</li>
<li class="pf-logout">
<a href="<%=basePath %>logout">
<i class="iconfont"></i>
<span class="pf-opt-name"><spring:message code="index.logout" /></span>
</a>
</li>
</ul>
</div>
</div>
</div>
<div id="pf-bd">
<div id="pf-sider">
<h2 class="pf-model-name">
<span class="iconfont"></span>
<span class="pf-name"><spring:message code="menu.name" /></span>
<span class="toggle-icon"></span>
</h2>
<ul class="sider-nav">
<li class="current">
<a href="javascript:;">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title"><spring:message code="menu.system" /></span>
<i class="iconfont"></i>
</a>
<ul class="sider-nav-s">
<li class="active"><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.role" />||system/role/list',this)"><spring:message code="menu.role" /></a></li>
<li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.agent" />||agent/list',this)"><spring:message code="menu.agent" /></a></li>
<li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.user" />||system/user/list',this)"><spring:message code="menu.user" /></a></li>
</ul>
</li>
<li>
<a href="javascript:;" onclick="addTab('<spring:message code="menu.delivery" />||delivery/list',this)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title"><spring:message code="menu.delivery" /></span>
</a>
</li>
<li>
<a href="javascript:void(0);">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title"><spring:message code="menu.awb" /></span>
<i class="iconfont"></i>
</a>
<ul class="sider-nav-s">
<li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.zhawb" />||bill/list?type=domestic',this)"><spring:message code="menu.zhawb" /></a></li>
<li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.enawb" />||bill/list?type=national',this)"><spring:message code="menu.enawb" /></a></li>
</ul>
</li>
<li>
<a href="javascript:void(0)" onclick="addTab('账单核审||billcheck/report',this)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title">账单核审</span>
</a>
</li>
<li>
<a href="javascript:void(0)" onclick="addTab('办单||handlebill/list',this)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title">办单</span>
</a>
</li>
<li>
<a href="javascript:void(0)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title">货况追踪</span>
</a>
</li>
<li>
<a href="javascript:void(0)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title">预配舱单</span>
</a>
</li>
<li>
<a href="javascript:void(0)">
<span class="iconfont sider-nav-icon"></span>
<span class="sider-nav-title">分拨分流申请</span>
</a>
</li>
</ul>
</div>
<style>
.tabs-panels{
padding:10px 5px 5px 10px;
}
</style>
<div id="pf-page">
<div class="easyui-tabs1" style="width:100%;height:100%;">
<div title="<spring:message code="user.modifypwd"/>" data-options="closable:true">
<div class="content">
<form class="from-control" id="form">
<table class="kv-table">
<tbody>
<tr>
<input type="hidden" id="id" name="id" value="${userid}">
<td class="kv-label"><spring:message code="user.oldpwd"/></td>
<td class="kv-content">
<input type="password" id="originalpassword" name="originalpassword" required maxlength="30">
</td>
</tr>
<tr>
<td class="kv-label"><spring:message code="user.newpwd"/></td>
<td class="kv-content"><input type="password" name="newpassword" id="newpassword" required maxlength="30"><span id="showStrength"></span>
</td>
</tr>
<tr>
<td class="kv-label"><spring:message code="user.conpwd"/></td>
<td class="kv-content"><input type="password" name="confirmnewpassword" id="confirmnewpassword" required maxlength="30">
</td>
</tr>
<tr>
<td colspan="6">
<div class="opt-buttons" style="padding-top:20px;">
<button type="submit" href="javascript:doSave()" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
<span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save"/></span></span>
</button>
<button type="button" class="easyui-linkbutton l-btn l-btn-small" onclick="window.location.href='<%=basePath%>system/user/list'">
<span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.cancel"/></span></span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="pf-ft">
<div class="system-name">
<i class="iconfont"></i>
<span><spring:message code="app.name" /> v1.0</span>
</div>
<div class="copyright-name">
<span>CopyRight 2017 版权所有</span>
<i class="iconfont" ></i>
</div>
</div>
</div>
<script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
var centerTabs= $('.easyui-tabs1').tabs({
tabHeight: 44,
onSelect:function(title,index){
var currentTab = $('.easyui-tabs1').tabs("getSelected");
if(currentTab.find("iframe") && currentTab.find("iframe").size()){
currentTab.find("iframe").attr("src",currentTab.find("iframe").attr("src"));
}
}
})
$(window).resize(function(){
$('.tabs-panels').height($("#pf-page").height()-46);
$('.panel-body').height($("#pf-page").height()-76)
}).resize();
//tab 联动
function addTab(node) {
var nodes=node.split("||");
if(centerTabs.tabs('exists', nodes[0])){
centerTabs.tabs('select',nodes[0]);
}else{
centerTabs.tabs('add',{
title:nodes[0],
closable:true,
content:"<iframe class='page-iframe' src='<%=basePath %>system/role/list' frameborder='no' border='no' height='100%' width='100%' scrolling='auto'></iframe>"
});
}
}
$(function(){
$("#form").validate({
rules:{
confirmnewpassword : {
equalTo : "#newpassword"
}
},
messages:{
confirmnewpassword : "<spring:message code="opt.inputpwdagain"/>"
},
submitHandler:function(form){
doSave();
}
});
});
function doSave(){
var originalpassword = $("#originalpassword").val();
var newpassword = $("#newpassword").val();
var confirmnewpassword = $("#confirmnewpassword").val();
var id = $("#id").val();
$.get("<%=basePath %>system/user/verifyPassword",{id:id, originalpassword:originalpassword},function(data){
if(data.status==500){
layer.open({content:"<spring:message code="user.differpwd"/>"});
return;
}else if(data.status==200){
$.post("<%=basePath %>system/user/savepassword",{id:id, originalpassword:originalpassword,newpassword:newpassword,confirmnewpassword:confirmnewpassword},function(data){
if(data.status==200){
layer.confirm("<spring:message code="opt.savesuccess"/>",{btn:['<spring:message code="opt.confirm"/>','<spring:message code="opt.cancel"/>']},function(){
window.location.href="<%=basePath %>system/user/list";
})
}else{
layer.open({content:"<spring:message code="opt.savefailed"/>"});
}
})
}
})
}
</script>
<script type="text/javascript">
var centerTabs= $('.easyui-tabs1').tabs({
tabHeight: 44,
onSelect:function(title,index){
var currentTab = $('.easyui-tabs1').tabs("getSelected");
//if(currentTab.find("iframe") && currentTab.find("iframe").size()){
//currentTab.find("iframe").attr("src",currentTab.find("iframe").attr("src"));
//}
//左侧菜单联动
}
})
$(window).resize(function(){
$('.tabs-panels').height($("#pf-page").height()-46);
$('.panel-body').height($("#pf-page").height()-76)
}).resize();
//tab 联动
function addTab(node,obj) {
var nodes=node.split("||");
if(centerTabs.tabs('exists', nodes[0])){
centerTabs.tabs('select',nodes[0]);
}else{
centerTabs.tabs('add',{
title:nodes[0],
closable:true,
content:"<iframe class='page-iframe' src='<%=basePath %>"+nodes[1]+"' frameborder='no' border='no' height='100%' width='100%' scrolling='auto'></iframe>"
});
}
//样式
$(".active").removeClass("active");
$(obj).parent().addClass("active");
}
//语言切换
function sLang(obj) {
var langVar = $(obj).val();
window.location.href="<%=basePath %>index?lang="+langVar;
}
// 验证密码强度
$("#newpassword")window.onload = function () {
function setCss(_this,cssOption){
//判断节点类型
if (!_this || _this.nodeType ===3 || _this.nodeType === 8 ||!_this.style) {
return;
}
for(var cs in cssOption){
_this.style[cs] = cssOption[cs];
}
return _this;
}
function trim(chars){
return (chars ||"").replace(/^(\s|\u00a0)+|(\s|\u00a0)+$/g,"");
}
function passwordStrength(newpassword,showStrength){
var self = this;
/*字符权重;
数字1,字母2,其他字符为3
当密码长度小于6时不符合标准
长度>=6,强度小于10,强度弱
长度>=6,长度>=10且<15,强度中
长度>=6,强度>=15,强*/
passwordStrength.onkeyup = function(){
var _color = ["red","yellow","orange","green"],
msgs = ["密码太短","弱","中","强"],
_strength = 0,
_v= trim(newpassword.value),
_vL= _v.length,
i=0;
var charStrength = function(char){
//计算单个字符强度
if(char>=48 && char <=57){//数字
return 1;
}
if(char>=97 && char<=122){//小写
return 2;
}else{
return 3; //特殊字符
}
}
if(_vL<8){//计算模式
showStrength.innerText = msgs[0];
setCss(showStrength,{
"color":_color[0]
})
}else{
for(;i<_vL;i++){
//遍历字符
_strength+=charStrength(_v.toLocaleLowerCase().charCodeAt(i));
}
if(_strength<10){
//强度小于10
showStrength.innerText = msgs[1];
setCss(showStrength,{
"color":_color[1]
})
}
if(_strength>=10&&_strength<15){
showStrength.innerText = msgs[2];
setCss(showStrength,{
"color":_color[2]
})
}
if(_strength>=15){
showStrength.innerText = msgs[3];
setCss(showStrength,{
"color":_color[3]
})
}
}
}
}
passwordStrength(
document.getElementById("newpassword"),
document.getElementById("showStrength"));
};
</script>
</body>
</html>