弱密码强制修改

master
ALW 3 years ago
parent 07aebd5c12
commit d240697b68

@ -58,9 +58,7 @@ public class LoginController {
@RequestMapping(value = "login",method = RequestMethod.POST)
public String login(Power_User powerUser,HttpServletResponse response, HttpServletRequest request,Model model) throws Exception {
//同一浏览器打开login直接触发注销登录session
// loginService.removeOldUserOnLogin(request);
// WsPool.addUser(conn);
String userPwd = powerUser.getUserPwd();
try {
Power_UserVo user = powerUserService.findPowerUserByUserNameAndUserPwd(powerUser);
//添加进操作日志
@ -145,11 +143,16 @@ public class LoginController {
}
user.setDeptIdQuality(power_depts3.toString());
}
//设置进缓存
CacheManager.putCache(token,new Cache(date,user,TOKEN_EXPIRE_TIME));
ActionScopeUtils.setSessionAttribute("CURRENT_USER",user,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME))/1000);
return "redirect:gatewayPage";
String reg = "^(?![A-Za-z]+$)(?![A-Z\\d]+$)(?![A-Z\\W]+$)(?![a-z\\d]+$)(?![a-z\\W]+$)(?![\\d\\W]+$)\\S{8,20}$";
boolean msg=userPwd.matches(reg);
if (msg==false){
return "/userDir/updatePassword1";
}else {
return "redirect:gatewayPage";
}
}else{
//登录失败
Integer wrongNum = 1;

@ -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>

@ -236,12 +236,12 @@
</select>
</div>
<div class="formDiv">
<label class="control-label left">有效否:</label>
<select class="form-control input input-sm shortInput" id="re_effective" name="effective">
<option value="1">是</option>
<option value="0">否</option>
</select>
</div>
<label class="control-label left">有效否:</label>
<select class="form-control input input-sm shortInput" id="re_effective" name="effective">
<option value="1">是</option>
<option value="0">否</option>
</select>
</div>
<div class="formDiv">
<label class="control-label left">备注:</label>
<textarea id="re_remark" class="form-control input input-sm" name="remark" maxlength="50"></textarea>

@ -217,24 +217,11 @@
<option value="${dept.deptId}" <c:if test="${deptId == dept.deptId}">selected</c:if>>${dept.deptName}</option>
</c:forEach>
</select>
<%-- <input id="txtTreeSelect1" type="text" onclick="showMenu1(); return false;"
class="form-control input-sm input" placeholder="所属科室"
name="parentId1"
data-id=""
readonly="readonly"
/>
<input type="hidden" id="deptIds" name="deptId">--%>
</div>
</div>
<%--<div id="menuContent1" class="menuContent" style="display:none;background: #f9f9f9;
position:static;z-index:10;width:288px;margin-left:170px">
<ul id="treeDemo" class="ztree" style="margin-top: 0; width: 178px;">
</ul>
</div>--%>
<div class="formDiv">
<label class="control-label left">所属角色:</label>
<select class="form-control input input-sm" id="re_roleId" name="roleId">
</select>
</div>
<div class="formDiv">

@ -1,7 +1,7 @@
/**
* Created by ljx on 2019/4/25.
*/
$(function(){
$(function () {
//cookie数据保存格式是key=value;key=value;形式loginInfo为保存在cookie中的key值具体看controller代码
/*if(str != ""){
var userName = str.split("#")[0];
@ -12,7 +12,7 @@ $(function(){
//并且选中复选框
$("#rememberMe").attr("checked", true);
}*/
//获取cookie
/*function getCookie(cname) {
var name = cname + "=";
@ -25,23 +25,23 @@ $(function(){
return "";
}*/
$("#forgetPwd").on("click",function(){
$("#forgetPwd").on("click", function () {
alert("请联系管理员进行修改密码!");
});
$("#smdl").on("click", function (){
$("#smdl").on("click", function () {
$.ajax({
type: "post",
url : "methodForEmrMedical/getErweima",
url: "methodForEmrMedical/getErweima",
data: {
responseType:"code",
responseType: "code",
//clientId:"2017070411003376",
clientId:"2019111514014789",
clientId: "2019111514014789",
selfSign: "true"
},
success : function(data) {
success: function (data) {
var requestId = "";
$.each(data,function (index, obj){
$.each(data, function (index, obj) {
//获取二维码
var imgBase64 = obj.imgBase64;
var zhdl = document.getElementById("zhdl");
@ -61,17 +61,17 @@ $(function(){
function polling(requestId, delay = 1000) {
return new Promise((resolve, reject) =>{
return new Promise((resolve, reject) => {
$.ajax({
type: "post",
url : "methodForEmrMedical/getUser",
url: "methodForEmrMedical/getUser",
data: {
requestId: requestId,
//clientId:"2017070411003376"
clientId:"2019111514014789"
clientId: "2019111514014789"
},
success: function (data) {
$.each(data,function (index, obj){
$.each(data, function (index, obj) {
//轮询查询接口
if (obj === '未授权') { //是否继续轮询
setTimeout(() => {
@ -91,16 +91,15 @@ $(function(){
function smlogin(user) {
$.ajax({
type: "post",
url : "methodForEmrMedical/smlogin",
url: "methodForEmrMedical/smlogin",
data: {
openId: user.openId,
//clientId:"2017070411003376"
clientId:"2019111514014789"
clientId: "2019111514014789"
},
success: function (data) {
if (data.isSuccess){
window.location.href = data.url;
}else {
if (data.isSuccess) {
window.location.href = data.url;
} else {
//window.location.href = data.url;
window.location.reload();
alert(data.msg);
@ -112,27 +111,27 @@ $(function(){
});
$('body').keydown(function () {
if(event.keyCode == '13'){
if (event.keyCode == '13') {
var userName = $("#userName").val();
var userPwd = $("#userPwd").val();
var rememberMeChecked = $("input[type='checkbox']").is(':checked');
var rememberMe = '';
if(rememberMeChecked){
if (rememberMeChecked) {
rememberMe = 'yes';
}
if(userName == ''){
if (userName == '') {
toastr.warning("用户名不能为空!");
}else{
if(userPwd == ''){
} else {
if (userPwd == '') {
toastr.warning("密码不能为空!");
}else{
} else {
$.ajax({
type : "POST",
url : path+"/login",
data: {userName:userName, userPwd:userPwd,rememberMe:rememberMe},
success : function(data) {
//window.location.href = 'gatewayPage';
type: "POST",
url: path + "/login",
data: {userName: userName, userPwd: userPwd, rememberMe: rememberMe},
success: function (data) {
},
})
}

@ -11,14 +11,6 @@ $(function() {
//提交更改
$('#btn_submit').click(function () {
/*if($("#userPwd").val() == ""){
toastr.warning("旧密码不能为空!")
return false;
}
if($("#userPwd").val().length < 8){
toastr.warning("旧密码长度小于8位")
return false;
}*/
if($("#newUserPwd").val() == ""){
toastr.warning("新密码不能为空!")
return false;
@ -38,10 +30,10 @@ $(function() {
//reg=/^(?=.*[a-z])(?=.*\d)[a-zA-Z\d]{8,}$/;
// reg = /^(?![\d]+$)(?![a-z]+$)(?![A-Z]+$)(?![`~!@#$%^&*()-_=+\|[{}];:'",<.>\/?]+$)[\da-zA-z`~!@#$%^&*()-_=+\|[{}];:'",<.>\/?]{8,}$/;
//~!@#$%^&*()-_=+\|[{}];:'",<.>/?
reg = /^(?![\d]+$)(?![a-z]+$)(?![A-Z]+$)(?![!#$@%^&*()\[{}\]:;'",<.>/ ]+$)[\da-zA-z!#$%@^&*()\[{}\]:;'",<.>/ ]{8,}$/;
reg = /^(?![A-Za-z]+$)(?![A-Z\d]+$)(?![A-Z\W]+$)(?![a-z\d]+$)(?![a-z\W]+$)(?![\d\W]+$)\S{8,20}$/;
var mm = $("#newUserPwd").val();
if (!reg.test($("#newUserPwd").val())) {
toastr.warning("密码格式必须包含数字、字母、特殊符号跟空格任意两种组合!")
toastr.warning("口令必须包含如下字符的组合:一个小写字母、个大写字母、一数字、一特殊字符!")
return false;
}

Loading…
Cancel
Save