406 lines
18 KiB
Plaintext
406 lines
18 KiB
Plaintext
<!DOCTYPE html>
|
||
<%@page import="com.sipai.tools.CommString"%>
|
||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ page import="java.net.URLDecoder"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||
<html lang="zh-CN">
|
||
<!-- BEGIN HEAD -->
|
||
<head>
|
||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||
<style type="text/css">
|
||
.fa_eye {
|
||
color: #ccc;
|
||
display: block;
|
||
position: absolute;
|
||
margin: 8px;
|
||
z-index: 3;
|
||
width: 16px;
|
||
font-size: 16px;
|
||
text-align: center;
|
||
right: 15px;
|
||
top: 0;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
function dosave() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/user/saveChangePassword.do", $("#subForm").serialize(), function(data) {
|
||
if (data == 1) {
|
||
showAlert('s','修改成功');
|
||
closeModal('subPasswordModal');
|
||
$.post(ext.contextPath+"/Login/logout.do",function(){
|
||
delCookie("j_username");
|
||
delCookie("j_password");
|
||
location.replace(ext.contextPath);
|
||
});
|
||
}else if(data == 2){
|
||
showAlert('d','原始密码错误 ');
|
||
}else if(data == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
}
|
||
function logout() {
|
||
swal({
|
||
text: "您确定要退出吗?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
className: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
className: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(function(willDelete) {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath+"/Login/logout.do",function(){
|
||
delCookie("j_password");
|
||
delCookie('savePassword');
|
||
location.replace(ext.contextPath);
|
||
});
|
||
}
|
||
});
|
||
};
|
||
|
||
//读取cookies
|
||
function getCookie(name) {
|
||
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
|
||
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
|
||
else return null;
|
||
}
|
||
//删除cookies
|
||
function delCookie(name) {
|
||
var exp = new Date();
|
||
exp.setTime(exp.getTime() - 1);
|
||
var cval=getCookie(name);
|
||
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
|
||
}
|
||
function switchPwd() {
|
||
var passwordeye = $('.fa_eye');
|
||
passwordeye.each(function(){
|
||
$(this).off('click').on('click',function(){
|
||
if($(this).hasClass('fa-eye-slash')){
|
||
$(this).removeClass('fa-eye-slash').addClass('fa-eye');//密码可见
|
||
$(this).prev().prop('type','text');
|
||
}else{
|
||
if($(this).hasClass('fa-eye')){
|
||
$(this).removeClass('fa-eye').addClass('fa-eye-slash');//密码不可见
|
||
$(this).prev().prop('type','password');
|
||
}
|
||
};
|
||
});
|
||
});
|
||
}
|
||
$(function() {
|
||
var type = "strong";
|
||
var max = 18;
|
||
var min = 10;
|
||
//配置logo
|
||
var array = eval(${jsonArray});
|
||
if(array!=null && array!=undefined && array.length>0){
|
||
for(var i =0;i<array.length;i++){
|
||
if(array[i].id == "password-type"){
|
||
if(array[i].type!=null){
|
||
type = array[i].type;
|
||
}
|
||
}
|
||
if(array[i].id == "password-max"){
|
||
if(array[i].type!=null){
|
||
max = array[i].type;
|
||
}
|
||
}
|
||
if(array[i].id == "password-min"){
|
||
if(array[i].type!=null){
|
||
min = array[i].type;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
$('#minAndMax').html("至少"+min+"个字符,最多"+max+"个字符");
|
||
if(type=="strong"){
|
||
$('#passwordType').html("用户密码必须包含大小写字母、数字、特殊字符");
|
||
//输入框验证
|
||
$('#subForm').bootstrapValidator({
|
||
fields: {
|
||
/*验证:规则*/
|
||
oldPassword: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '用户原始密码不能为空'
|
||
},
|
||
/* stringLength: {
|
||
min: 6,
|
||
max: 19,
|
||
message: '用户原始密码长度大于5小于20'
|
||
}, */
|
||
regexp: {
|
||
regexp: /^[^ ]+$/,
|
||
//regexp:/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{10,18}$/,
|
||
message: '用户原始密码不能有空格'
|
||
},
|
||
different: { //比较
|
||
field: 'newPassword', //需要进行比较的input name值
|
||
message: '新密码不能与原始密码相同'
|
||
},
|
||
}
|
||
},
|
||
newPassword: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '用户新密码不能为空'
|
||
},
|
||
identical: {
|
||
field: 'comfirmPassword',
|
||
message: '用户新密码与确认密码不一致!'
|
||
},
|
||
stringLength: {
|
||
min: min,
|
||
max: max,
|
||
message: '用户新密码长度大于等于'+min+'小于等于'+max,
|
||
},
|
||
regexp: {
|
||
//regexp: /^[^ ]+$/,
|
||
regexp:'^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{'+min+','+max+'}$',
|
||
message: '用户密码不符合要求'
|
||
},
|
||
different: { //比较
|
||
field: 'oldPassword', //需要进行比较的input name值
|
||
message: '新密码不能与原始密码相同'
|
||
},
|
||
|
||
}
|
||
},
|
||
comfirmPassword: {
|
||
validators: {
|
||
identical: {
|
||
field: 'newPassword',
|
||
message: '用户新密码与确认密码不一致!'
|
||
},
|
||
notEmpty: {
|
||
message: '用户确认密码不能为空'
|
||
},
|
||
stringLength: {
|
||
min: min,
|
||
max: max,
|
||
message: '用户新密码长度大于等于'+min+'小于等于'+max,
|
||
},
|
||
regexp: {
|
||
//regexp: /^[^ ]+$/,
|
||
regexp:'^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{'+min+','+max+'}$',
|
||
message: '用户密码不符合要求'
|
||
},
|
||
different: { //比较
|
||
field: 'oldPassword', //需要进行比较的input name值
|
||
message: '新密码不能与原始密码相同'
|
||
},
|
||
}
|
||
}
|
||
}
|
||
})
|
||
.on('error.validator.bv', function (e, data) {//这个方法是让错误信息只显示最新的一个(有时会出现多个错误信息同时显示用这个方法解决)
|
||
data.element
|
||
.data('bv.messages')
|
||
.find('.help-block[data-bv-for="' + data.field + '"]').hide()
|
||
.filter('[data-bv-validator="' + data.validator + '"]').show();
|
||
})
|
||
.on('error.field.bv', function (e, data) {//‘用户确认密码’ 没输入的时候,‘用户新密码’不提示‘用户新密码与确认密码不一致’
|
||
if (data.field == 'newPassword') {
|
||
var len1 = data.element.val().length;
|
||
var len2 = $('#comfirmPassword').val().length;
|
||
var k = data.element.val().indexOf(" ");
|
||
if (len1 > 5 && len2 < 6 && k < 0) {
|
||
var $parent = data.element.parents('.form-group');
|
||
$parent.removeClass('has-error');
|
||
$parent.find('.[data-bv-icon-for="' + data.field + '"]').hide();
|
||
data.element.siblings('[data-bv-validator="identical"]').hide();
|
||
}
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
if(type=="weak"){
|
||
$('#passwordType').html("用户密码不能有空格");
|
||
//输入框验证
|
||
$('#subForm').bootstrapValidator({
|
||
fields: {
|
||
/*验证:规则*/
|
||
oldPassword: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '用户原始密码不能为空'
|
||
},
|
||
/* stringLength: {
|
||
min: 6,
|
||
max: 19,
|
||
message: '用户原始密码长度大于5小于20'
|
||
}, */
|
||
regexp: {
|
||
regexp: /^[^ ]+$/,
|
||
message: '用户原始密码不能有空格'
|
||
}
|
||
}
|
||
},
|
||
newPassword: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '用户新密码不能为空'
|
||
},
|
||
identical: {
|
||
field: 'comfirmPassword',
|
||
message: '用户新密码与确认密码不一致!'
|
||
},
|
||
stringLength: {
|
||
min: min,
|
||
max: max,
|
||
message: '用户新密码长度大于等于'+min+'小于等于'+max,
|
||
},
|
||
regexp: {
|
||
regexp: /^[^ ]+$/,
|
||
message: '用户密码不符合要求'
|
||
}
|
||
|
||
}
|
||
},
|
||
comfirmPassword: {
|
||
validators: {
|
||
identical: {
|
||
field: 'newPassword',
|
||
message: '用户新密码与确认密码不一致!'
|
||
},
|
||
notEmpty: {
|
||
message: '用户确认密码不能为空'
|
||
},
|
||
stringLength: {
|
||
min: min,
|
||
max: max,
|
||
message: '用户新密码长度大于等于'+min+'小于等于'+max,
|
||
},
|
||
regexp: {
|
||
regexp: /^[^ ]+$/,
|
||
message: '用户密码不符合要求'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
})
|
||
.on('error.validator.bv', function (e, data) {//这个方法是让错误信息只显示最新的一个(有时会出现多个错误信息同时显示用这个方法解决)
|
||
data.element
|
||
.data('bv.messages')
|
||
.find('.help-block[data-bv-for="' + data.field + '"]').hide()
|
||
.filter('[data-bv-validator="' + data.validator + '"]').show();
|
||
})
|
||
.on('error.field.bv', function (e, data) {//‘用户确认密码’ 没输入的时候,‘用户新密码’不提示‘用户新密码与确认密码不一致’
|
||
if (data.field == 'newPassword') {
|
||
var len1 = data.element.val().length;
|
||
var len2 = $('#comfirmPassword').val().length;
|
||
var k = data.element.val().indexOf(" ");
|
||
if (len1 > 5 && len2 < 6 && k < 0) {
|
||
var $parent = data.element.parents('.form-group');
|
||
$parent.removeClass('has-error');
|
||
$parent.find('.[data-bv-icon-for="' + data.field + '"]').hide();
|
||
data.element.siblings('[data-bv-validator="identical"]').hide();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
switchPwd();
|
||
})
|
||
</script>
|
||
</head>
|
||
<body class="hold-transition register-page">
|
||
<div class="register-box">
|
||
<div class="register-logo">
|
||
<c:if test="${not empty cu.userDetail}">
|
||
<c:choose>
|
||
<c:when test="${not empty cu.userDetail.icon}">
|
||
<img src="${cu.userDetail.icon}"class="profile-user-img img-responsive img-circle" alt="User Image">
|
||
</c:when>
|
||
<c:otherwise>
|
||
<c:choose>
|
||
<c:when test="${cu.sex=='0'}">
|
||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar2.png" class="profile-user-img img-responsive img-circle" alt="User Image">
|
||
</c:when>
|
||
<c:otherwise>
|
||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar5.png" class="profile-user-img img-responsive img-circle" alt="User Image">
|
||
</c:otherwise>
|
||
</c:choose>
|
||
</c:otherwise>
|
||
</c:choose>
|
||
</c:if>
|
||
<!--如果用户没有上传过头像,显示系统默认头像 -->
|
||
<c:if test="${empty cu.userDetail}">
|
||
<c:choose>
|
||
<c:when test="${cu.sex=='0'}">
|
||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar2.png" class="profile-user-img img-responsive img-circle" alt="User Image">
|
||
</c:when>
|
||
<c:otherwise>
|
||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar5.png" class="profile-user-img img-responsive img-circle" alt="User Image">
|
||
</c:otherwise>
|
||
</c:choose>
|
||
</c:if>
|
||
<h3 class="profile-username text-center">${cu.caption}</h3>
|
||
</div>
|
||
<div class="register-box-body">
|
||
<p class="login-box-msg "><c:choose>
|
||
<c:when test="${titleStr!='' && titleStr!=null}">${titleStr}</c:when>
|
||
<c:otherwise>修改原始密码</c:otherwise>
|
||
</c:choose></p>
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm" enctype="multipart/form-data" >
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div class="form-group has-feedback">
|
||
|
||
<label class="control-label col-sm-3">原始密码</label>
|
||
<div class="col-sm-9">
|
||
<input class="form-control" type="password" placeholder="原始密码"
|
||
name="oldPassword" id="oldPassword"/>
|
||
<a class="fa fa-eye-slash fa_eye "></a>
|
||
</div>
|
||
</div>
|
||
<div class="form-group has-feedback">
|
||
<label class="control-label col-sm-3">新密码</label>
|
||
<div class="col-sm-9">
|
||
<input class="form-control" type="password" placeholder="新密码"
|
||
name="newPassword" id="newPassword"/>
|
||
<a class="fa fa-eye-slash fa_eye "></a>
|
||
</div>
|
||
</div>
|
||
<div class="form-group has-feedback">
|
||
<label class="control-label col-sm-3">确认密码</label>
|
||
<div class="col-sm-9">
|
||
<input class="form-control" type="password" placeholder="确认密码"
|
||
name="comfirmPassword" id="comfirmPassword"/>
|
||
<a class="fa fa-eye-slash fa_eye "></a>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<div class="social-auth-links text-center">
|
||
<p id="passwordType">用户密码必须包含大小写字母、数字、特殊字符</p>
|
||
<p id="minAndMax">至少10个字符,最多18个字符</p>
|
||
<a href="#" class="btn btn-block btn-primary" onclick="dosave()" >确认</a>
|
||
<a href="#" class="btn btn-block btn-danger" onclick="logout()" >退出</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|