解决用户的重置密码的bug
This commit is contained in:
@@ -235,7 +235,7 @@ public class UserController extends BaseController {
|
|||||||
Long id = jsonObject.getLong("id");
|
Long id = jsonObject.getLong("id");
|
||||||
String password = "123456";
|
String password = "123456";
|
||||||
String md5Pwd = Tools.md5Encryp(password);
|
String md5Pwd = Tools.md5Encryp(password);
|
||||||
int update = userService.resetPwd(md5Pwd, id);
|
int update = userService.resetPwd(md5Pwd, id, request);
|
||||||
if(update > 0) {
|
if(update > 0) {
|
||||||
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);
|
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"},
|
@WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"},
|
||||||
initParams = {@WebInitParam(name = "filterPath",
|
initParams = {@WebInitParam(name = "filterPath",
|
||||||
value = "/jshERP-boot/user/login#/jshERP-boot/user/weixinLogin#/jshERP-boot/user/weixinBind#" +
|
value = "/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#" +
|
||||||
"/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#" +
|
|
||||||
"/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#" +
|
|
||||||
"/jshERP-boot/systemConfig/static#/jshERP-boot/api/plugin/wechat/weChat/share#" +
|
"/jshERP-boot/systemConfig/static#/jshERP-boot/api/plugin/wechat/weChat/share#" +
|
||||||
"/jshERP-boot/api/plugin/general-ledger/pdf/voucher#/jshERP-boot/api/plugin/tenant-statistics/tenantClean")})
|
"/jshERP-boot/api/plugin/general-ledger/pdf/voucher#/jshERP-boot/api/plugin/tenant-statistics/tenantClean")})
|
||||||
public class LogCostFilter implements Filter {
|
public class LogCostFilter implements Filter {
|
||||||
@@ -46,21 +44,23 @@ public class LogCostFilter implements Filter {
|
|||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (requestUrl != null && (requestUrl.contains("/doc.html") ||
|
if (requestUrl != null && (requestUrl.equals("/jshERP-boot/doc.html") ||
|
||||||
requestUrl.contains("/user/login") || requestUrl.contains("/user/register"))) {
|
requestUrl.equals("/jshERP-boot/user/login") || requestUrl.equals("/jshERP-boot/user/register")
|
||||||
|
|| requestUrl.equals("/jshERP-boot/user/weixinLogin") || requestUrl.equals("/jshERP-boot/user/weixinBind")
|
||||||
|
|| requestUrl.equals("/jshERP-boot/user/registerUser") || requestUrl.equals("/jshERP-boot/user/randomImage"))) {
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null != allowUrls && allowUrls.length > 0) {
|
if (null != allowUrls && allowUrls.length > 0) {
|
||||||
for (String url : allowUrls) {
|
for (String url : allowUrls) {
|
||||||
if (requestUrl.startsWith(url)) {
|
if (requestUrl != null && requestUrl.startsWith(url)) {
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
servletResponse.setStatus(500);
|
servletResponse.setStatus(500);
|
||||||
if(requestUrl != null && !requestUrl.contains("/user/logout") && !requestUrl.contains("/function/findMenuByPNumber")) {
|
if(requestUrl != null && !requestUrl.equals("/jshERP-boot/user/logout") && !requestUrl.equals("/jshERP-boot/function/findMenuByPNumber")) {
|
||||||
servletResponse.getWriter().write("loginOut");
|
servletResponse.getWriter().write("loginOut");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int resetPwd(String md5Pwd, Long id) throws Exception{
|
public int resetPwd(String md5Pwd, Long id, HttpServletRequest request) throws Exception{
|
||||||
int result=0;
|
int result=0;
|
||||||
logService.insertLog("用户",
|
logService.insertLog("用户",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
||||||
@@ -211,7 +211,11 @@ public class UserService {
|
|||||||
user.setId(id);
|
user.setId(id);
|
||||||
user.setPassword(md5Pwd);
|
user.setPassword(md5Pwd);
|
||||||
try{
|
try{
|
||||||
result=userMapper.updateByPrimaryKeySelective(user);
|
//判断是否登录过
|
||||||
|
Object userId = redisService.getObjectFromSessionByKey(request,"userId");
|
||||||
|
if (userId != null) {
|
||||||
|
result = userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user