强制跳转修改密码

master
linjj 2 years ago
parent c8d6529a41
commit 4142cd95f7

@ -102,7 +102,10 @@ public class PageController {
user.setMenus(menus);*/
return "/loginDir/index";
}
@RequestMapping(value = "updatePassword")
public String updatePassword(Model model , HttpServletRequest request){
return"/userDir/updatePassword1";
}
@RequestMapping(value = "gatewayPage")
public String register(Model model, HttpServletRequest request,Integer noticeId){
model.addAttribute("EMRMEDICALRECORD_URLHEAD",EMRMEDICALRECORD_URLHEAD);

@ -0,0 +1,59 @@
<%--
Created by IntelliJ IDEA.
User: ljx
Date: 2019/5/13
Time: 17:02
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>密码过于简单请修改密码在登录</title>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
</head>
<body>
<form class="form-horizontal" role="form">
<fieldset>
<legend style="text-align: center;font-weight: bold;font-size: 25px">密码过于简单请修改密码在登录</legend>
</fieldset>
<form>
<%--<div class="form-group">--%>
<%--<label for="userPwd" class="col-sm-2 control-label">旧密码</label>--%>
<%--<div class="col-sm-5">--%>
<%--<input type="password" class="form-control" readonly value="${user.userPwd}" id="userPwd"--%>
<%--placeholder="请输入旧密码">--%>
<%--</div>--%>
<%--</div>--%>
<div class="form-group">
<label for="newUserPwd" class="col-sm-2 control-label">密码</label>
<div class="col-sm-5">
<input type="password" class="form-control" id="newUserPwd" name="newUserPwd" onblur="AnalyzePasswordSecurityLevel('newUserPwd')"
placeholder="请输入新密码" maxlength="16">
</div>
<div id="newUserPwdText" class="col-sm-2" style="color: red">
</div>
</div>
<div class="form-group">
<label for="newReUserPwd" class="col-sm-2 control-label">重复密码</label>
<div class="col-sm-5">
<input type="password" class="form-control" id="newReUserPwd" onblur="AnalyzePasswordSecurityLevel('newReUserPwd')"
placeholder="请输入重复密码" maxlength="16">
</div>
<div id="newReUserPwdText" class="col-sm-2" style="color: red">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-primary" id="btn_submit">提交更改</button>
<button type="button" class="btn btn-default" id="btn_clear">清空</button>
</div>
</div>
</form>
</form>
</body>
<script src="${path}/static/js/updatePassword.js?t=1"></script>
</html>

@ -51,7 +51,13 @@ function login() {
url: path + "/login",
data: {userName: userName, userPwd: userPwd, rememberMe: rememberMe},
success: function (data) {
window.location.href = 'gatewayPage';
var reg = /^(?![A-Za-z]+$)(?![A-Z\d]+$)(?![A-Z\W]+$)(?![a-z\d]+$)(?![a-z\W]+$)(?![\d\W]+$)\S{8,20}$/;
if (!reg.test(userPwd)) {
window.location.href = 'updatePassword';
}else {
window.location.href = 'gatewayPage';
}
},
})
}
@ -64,61 +70,6 @@ $('body').keydown(function () {
}
})
var interval = "";
var qrCode = "";
function handoffLogin() {
$.ajax({
type: "POST",
url: path + '/font/getBase64',
success: function (data) {
var qrCodeImg = data.data.qrCodeImg;
$("#QRcordImg").prop("src", "data:image/jpeg;base64," + qrCodeImg);
qrCode = data.data.qrCode;
//轮询监听用户扫码
interval = setInterval(scanCodeLogin, 1000, qrCode);
}
})
$("#switchHandoff").css("display", "none");
$("#switchHandoff2").css("display", "flex");
}
function handoffLogin2() {
$("#switchHandoff").css("display", "block");
$("#switchHandoff2").css("display", "none");
clearInterval(interval);
}
function scanCodeLogin() {
$.ajax({
type: "POST",
data: {qrCode: qrCode},
url: path + '/font/getQueryQRCode',
success: function (body) {
if (body.data.qrCodeStatus == "LoginQrCodeExpire" || body.data.qrCodeStatus == "LoginQrCodeInvalid") {
handoffLogin()
return "";
}
var userIdCardNum = body.data.userIdCardNum;
if (userIdCardNum != "") {
clearInterval(interval);
$.ajax({
type: "POST",
url: path + "/font/XMZSYYlogin",
data: {idCard:userIdCardNum},
success: function (data) {
window.location.href = 'gatewayPage';
},
})
}
}
})
}

@ -35,19 +35,10 @@ $(function() {
toastr.warning("重复密码长度小于8位")
return false;
}
reg=/^(?=.*[a-z])(?=.*\d)[a-zA-Z\d]{8,}$/;
if (!reg.test($("#newUserPwd").val())) {
toastr.warning("密码格式必须包含数字和字母!")
return false;
}
if($("#newReUserPwd").val() != $("#newUserPwd").val() ){
toastr.warning("重复密码与密码不一致!")
return false;
}
$.ajax({
type: "post",
url: path+"/user/updatePassword",
@ -58,7 +49,8 @@ $(function() {
toastr.success("修改成功!");
setTimeout(function(){
window.location.reload();
},1000)
},1000
window.location.replace(path+"/login")
}else{
toastr.error("修改失败!");
}

Loading…
Cancel
Save