Commit 2396c515 authored by panhong18943's avatar panhong18943

新增登录密码过期

parent 446f72be
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="execute">
<bm:parameters>
<bm:parameter name="password_session_id" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@password_session_id"/>
</bm:parameters>
<bm:update-sql><![CDATA[
begin
sys_user_pkg.check_password_by_owner(
p_user_name =>${@user_name},
p_old_password => ${@current_password},
p_new_password => ${@update_password},
p_ip_address => ${/request/@address},
p_password_session_id =>${@password_session_id}
);
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
sys_user_pkg.change_password_by_owner(
p_user_name =>${@user_name},
p_old_password => ${@current_password},
p_new_password => ${@update_password},
p_ip_address => ${/request/@address}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="execute">
<bm:parameters>
<bm:parameter name="user_name" dataType="java.lang.String" input="true" output="false"/>
<bm:parameter name="encryted_session_id" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@encryted_session_id"/>
<bm:parameter name="message" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@message"/>
</bm:parameters>
<bm:update-sql><![CDATA[
begin
sys_login_pkg.expired_password(
p_user_name =>${@user_name},
p_encryted_session_id =>${@encryted_session_id},
p_error_message =>${@message}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -19,13 +19,56 @@
<link href="${base.contextPath}/lib/assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="${base.contextPath}/lib/assets/pages/css/login-5.css" rel="stylesheet" type="text/css"/>
<script src="${base.contextPath}/lib/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<link href="${base.contextPath}/resources/upload/favicon.png" rel="shortcut icon"/>
<script src="${base.contextPath}/javascripts/aes.js" type="text/javascript"></script>
<script type="text/javascript">var _baseContext = '${base.contextPath}'</script>
<script src="${base.contextPath}/javascripts/aes.js" type="text/javascript"></script>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' */lib;">
<meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" />
</head>
<body class=" login">
<style>
/* 弹窗的样式 */
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
margin-left: auto;
margin-right: auto;
width: 50%;
height: 50%;
overflow: auto;
padding-top: 60px;
}
/* 弹窗内容的样式 */
.modal-content {
background-color: #fefefe;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* 关闭按钮的样式 */
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
</style>
<script type="text/javascript">
function changeCaptchaCode() {
$("#imgObj").attr("src", '${base.contextPath}/verifiCode?_r=' + Math.random());
......@@ -45,6 +88,118 @@
var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
//document.getElementById('password').value= encrypted;
}
function checkLogin(){
var check = true;
$.ajax({
type: 'POST',
url: '${base.contextPath}/autocrud/sys.sys_user_login_with_userid/execute',
async: false, //设为同步
dataType: 'json',
data: {
user_name : document.getElementById('username').value
},
success: function (res) {
debugger;
if (res.result['encryted_session_id'] == 'ERROR') {
check = false;
} else {
check = true;
}
},
error: function() {
check = true;
}
});
return check;
}
window.onload = function()
{
// Listen to the double click event.
if (window.addEventListener) {
document.getElementById('loginForm').addEventListener('submit', function(event) {
// 阻止默认提交行为
event.preventDefault();
// 自定义处理逻辑
if (checkLogin()) {
// 如果验证通过,手动提交表单
this.submit();
} else {
alert('您的密码已经过期,请修改密码!');
//打开修改密码的弹窗
document.getElementById("user_name").value = document.getElementById('username').value.toUpperCase();
document.getElementById("user_name").readOnly = true;
var modal = document.getElementById("passwordModal");
modal.style.display = "block";
}
});
document.getElementById('passwordForm').addEventListener('submit', function(event) {
// 阻止默认提交行为
event.preventDefault();
// 自定义处理逻辑
if (checkUpdatePassword()) {
alert('修改成功');
// 如果验证通过,手动提交表单
window.top.location="${base.contextPath}/login";
}
});
};
};
//关闭弹窗
function closeModal(){
var modal = document.getElementById("passwordModal");
modal.style.display = "none";
document.getElementById("current_password").value = "";
document.getElementById("update_password").value = "";
document.getElementById("confirm_password").value = "";
}
//修改密码
function checkUpdatePassword(){
var username = document.getElementById('username').value;
var current_password = document.getElementById('current_password').value;
var update_password = document.getElementById('update_password').value;
var confirm_password = document.getElementById('confirm_password').value;
var check = true;
if (update_password != confirm_password){
alert('新密码和确认密码不一致');
check = false;
return check;
}
$.ajax({
type: 'POST',
url: '${base.contextPath}/autocrud/sys.password_expired_update/execute',
async: false, //设为同步
dataType: 'json',
data: {
user_name : username,
current_password : document.getElementById('current_password').value,
update_password : document.getElementById('update_password').value
},
success: function (res) {
debugger;
if (res.result['password_session_id'] == '校验成功') {
check = true;
} else {
alert(res.result['password_session_id']);
check = false;
}
},
error: function() {
check = false;
}
});
return check;
}
</script>
<style>
.user-login-5 input:-webkit-autofill {
......@@ -75,7 +230,7 @@
<div class="login-icon">
<!-- <img src="${base.contextPath}/lib/assets/pages/img/login/icon@2x.png" style="height: 28px">-->
</div>
<form id="loginForm" class="login-form" action="login" method="post" autocomplete="off">
<form id="loginForm" name="loginForm" class="login-form" action="login" method="post" autocomplete="off">
<div class="form-title">
<img src="${base.contextPath}/lib/assets/pages/img/login/icon@2x.png" style="height: 24px">
<p style="font-size: 18px;font-weight: bold;">宏菱建机融资租赁管理平台</p>
......@@ -95,7 +250,7 @@
</#if>
<div class="form-input">
<input class="form-control form-control-solid placeholder-no-fix" type="text"
autocomplete="off" placeholder="请输入用户名" name="username"/>
autocomplete="off" placeholder="请输入用户名" name="username" id="username"/>
</div>
<div class="form-input">
<input class="form-control form-control-solid placeholder-no-fix " placeholder="密码"
......@@ -131,14 +286,52 @@
</form>
</div>
<!-- <table width="340" cellspacing="0" cellpadding="0" style="margin-top: 30px">-->
<!-- <tr>-->
<!-- <td> 该网站的使用仅限于宏菱建机员工以及得到许可的用户。-->
<!-- 系统正在监督及保存所有系统内用户登录记录。-->
<!-- <strong>非法使用者</strong>根据相关法律需要承担民刑事的责任。-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<div id="passwordModal" class="modal" style="width: 500px; height: 530px">
<div class="modal-content">
<span class="close" onclick="closeModal()">&times;</span>
<form id="passwordForm" name="passwordForm" action="" method="post" >
<label>账号:</label>
<input class="form-control form-control-solid placeholder-no-fix" type="text"
autocomplete="off" name="user_name" id="user_name" />
<br/>
<label>原密码:</label>
<input class="form-control form-control-solid placeholder-no-fix" type="text"
autocomplete="off" name="current_password" id="current_password" required />
<br/>
<label >新密码:</label>
<input class="form-control form-control-solid placeholder-no-fix" type="text"
autocomplete="off" name="update_password" id="update_password" required/>
<br/>
<label >确认密码:</label>
<input class="form-control form-control-solid placeholder-no-fix" type="text"
autocomplete="off" name="confirm_password" id="confirm_password" required/>
<br/>
<div class="button-login">
<button class="btn blue" type="submit" style="min-width:100%;width: 100%;">确认</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$('#current_password').on('focus', function () {
$(this).attr('type', 'password');
})
$('#update_password').on('focus', function () {
$(this).attr('type', 'password');
})
$('#confirm_password').on('focus', function () {
$(this).attr('type', 'password');
})
</script>
<!-- <table width="340" cellspacing="0" cellpadding="0" style="margin-top: 30px">-->
<!-- <tr>-->
<!-- <td> 该网站的使用仅限于宏菱建机员工以及得到许可的用户。-->
<!-- 系统正在监督及保存所有系统内用户登录记录。-->
<!-- <strong>非法使用者</strong>根据相关法律需要承担民刑事的责任。-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<div class="login-footer" style="position: fixed;bottom: 10px;right: 10px;">
<div class="row bs-reset">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment