解决用户的重置密码的bug

This commit is contained in:
jishenghua
2025-08-06 23:20:48 +08:00
parent db479d6874
commit 324cc16882
3 changed files with 14 additions and 10 deletions

View File

@@ -235,7 +235,7 @@ public class UserController extends BaseController {
Long id = jsonObject.getLong("id");
String password = "123456";
String md5Pwd = Tools.md5Encryp(password);
int update = userService.resetPwd(md5Pwd, id);
int update = userService.resetPwd(md5Pwd, id, request);
if(update > 0) {
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);
} else {

View File

@@ -13,9 +13,7 @@ import java.io.IOException;
@WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"},
initParams = {@WebInitParam(name = "filterPath",
value = "/jshERP-boot/user/login#/jshERP-boot/user/weixinLogin#/jshERP-boot/user/weixinBind#" +
"/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#" +
"/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#" +
value = "/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/api/plugin/general-ledger/pdf/voucher#/jshERP-boot/api/plugin/tenant-statistics/tenantClean")})
public class LogCostFilter implements Filter {
@@ -46,21 +44,23 @@ public class LogCostFilter implements Filter {
chain.doFilter(request, response);
return;
}
if (requestUrl != null && (requestUrl.contains("/doc.html") ||
requestUrl.contains("/user/login") || requestUrl.contains("/user/register"))) {
if (requestUrl != null && (requestUrl.equals("/jshERP-boot/doc.html") ||
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);
return;
}
if (null != allowUrls && allowUrls.length > 0) {
for (String url : allowUrls) {
if (requestUrl.startsWith(url)) {
if (requestUrl != null && requestUrl.startsWith(url)) {
chain.doFilter(request, response);
return;
}
}
}
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");
}
}

View File

@@ -197,7 +197,7 @@ public class UserService {
}
@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;
logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
@@ -211,7 +211,11 @@ public class UserService {
user.setId(id);
user.setPassword(md5Pwd);
try{
//判断是否登录过
Object userId = redisService.getObjectFromSessionByKey(request,"userId");
if (userId != null) {
result = userMapper.updateByPrimaryKeySelective(user);
}
}catch(Exception e){
JshException.writeFail(logger, e);
}