Переглянути джерело

调整修改密码后手机号无法登陆

huangguoce 4 місяців тому
батько
коміт
fb11558cb0

+ 0 - 1
jeeplus-auth/src/main/java/com/jeeplus/auth/controller/LoginController.java

@@ -97,7 +97,6 @@ public class LoginController {
         long secondsUntilMidnight = Duration.between(now, midnight).getSeconds();
         RedisUtils.getInstance().expire(CacheNames.USER_CACHE_LOGIN_CODE + loginUserName , secondsUntilMidnight);
 
-
         //字典中限制显示次数
         Integer loginNumber = 5;
         if (redisLoginNumber >= 10){

+ 3 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -1313,6 +1313,7 @@ public class UserController {
                                                                   @RequestParam("code") String code,
                                                                   @RequestParam("newPassword") String newPassword) {
         HashMap<String,Object> j = new HashMap<String,Object>();
+        User user1 = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getMobile, mobile));
         // 判断当前页面输入的验证码是否与redis中存储的验证码匹配
         String redisCode = (String) redisUtils.get(mobile + "resetPassword");
         if (org.apache.commons.lang3.StringUtils.isNotBlank(redisCode)) {
@@ -1325,6 +1326,7 @@ public class UserController {
                         user.setUpPassword( "1" );
                         userService.updateById( user ); // 修改密码
                         redisUtils.delete(mobile + "resetPassword"); // 删除redis中的key
+                        redisUtils.delete ( CacheNames.USER_CACHE_LOGIN_NAME,user1.getTenantId()+":"+ mobile );
                         j.put("success",true);
                         j.put("message","密码修改成功!");
                     } else {
@@ -1657,6 +1659,7 @@ public class UserController {
             UserDTO userDTO = userService.get(id);
             if (null != userDTO){
                 RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_CODE + userDTO.getLoginName() , 0);
+                RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_CODE + userDTO.getMobile() , 0);
                 UserUtils.deleteCache ( userDTO );
             }
         }