diff --git a/src/main/java/jty/expressdistributionsystem/DTO/UserModifyPasswordDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/UserModifyPasswordDTO.java index 77dc6ee..284b49d 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/UserModifyPasswordDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/UserModifyPasswordDTO.java @@ -7,18 +7,19 @@ import lombok.Data; @Data public class UserModifyPasswordDTO { @NotBlank(message = "旧密码不能为空") - @Pattern(regexp = "^.+$") + @Pattern(regexp = "^.+$", message = "旧密码不能为空") private String oldPassword; @NotBlank(message = "新密码不能为空") - @Pattern(regexp = "^.+$") + @Pattern(regexp = "^.+$", message = "新密码不能为空") private String newPassword; @NotBlank(message = "再次输入的密码不能为空") - @Pattern(regexp = "^.+$") + @Pattern(regexp = "^.+$", message = "再次输入的密码不能为空") private String reNewPassword; @NotBlank(message = "身份证不能为空") - @Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|X|x)$") + @Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|X|x)$", + message = "身份证格式不正确") private String identity; } diff --git a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java index 1f6e86b..1ff7f94 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java @@ -68,7 +68,7 @@ public class CommonController { return new Result<>(401, "账号或者密码错误", ""); } User user = optionalUser.get(); - if(!Objects.equals(userLoginByAccountDTO.getMark(), user.getMark())) { + if (!Objects.equals(userLoginByAccountDTO.getMark(), user.getMark())) { return new Result<>(401, "请选择正确身份", ""); } if (user.getDisabled() == 1) { @@ -125,8 +125,8 @@ public class CommonController { // 修改个人密码 @PutMapping("/rePassword") - public Result modifyPassword(@RequestHeader("Authorization") String token, - @RequestBody @Validated @NotNull UserModifyPasswordDTO userModifyPasswordDTO) { + public Result modifyPassword( + @RequestBody @Validated @NotNull UserModifyPasswordDTO userModifyPasswordDTO) { // 判断密码 if (userModifyPasswordDTO.getOldPassword().equals(userModifyPasswordDTO.getNewPassword())) { return new Result<>(409, "新密码不得和旧密码一致", ""); @@ -142,8 +142,6 @@ public class CommonController { user.setPassword(Md5Util.getMD5String(userModifyPasswordDTO.getNewPassword())); user.setUpdateTime(null); userService.updateById(user); - // 删除redis当中的token - stringRedisTemplate.delete(token); // 删除当前线程的存储信息 ThreadLocalUtil.remove(); return new Result<>(200, "密码修改成功, 请重新登陆", "");