grs
yjxx 3 weeks ago
parent 53aa97a461
commit 31ba23d47f

@ -7,18 +7,19 @@ import lombok.Data;
@Data @Data
public class UserModifyPasswordDTO { public class UserModifyPasswordDTO {
@NotBlank(message = "旧密码不能为空") @NotBlank(message = "旧密码不能为空")
@Pattern(regexp = "^.+$") @Pattern(regexp = "^.+$", message = "旧密码不能为空")
private String oldPassword; private String oldPassword;
@NotBlank(message = "新密码不能为空") @NotBlank(message = "新密码不能为空")
@Pattern(regexp = "^.+$") @Pattern(regexp = "^.+$", message = "新密码不能为空")
private String newPassword; private String newPassword;
@NotBlank(message = "再次输入的密码不能为空") @NotBlank(message = "再次输入的密码不能为空")
@Pattern(regexp = "^.+$") @Pattern(regexp = "^.+$", message = "再次输入的密码不能为空")
private String reNewPassword; private String reNewPassword;
@NotBlank(message = "身份证不能为空") @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; private String identity;
} }

@ -125,7 +125,7 @@ public class CommonController {
// 修改个人密码 // 修改个人密码
@PutMapping("/rePassword") @PutMapping("/rePassword")
public Result<String> modifyPassword(@RequestHeader("Authorization") String token, public Result<String> modifyPassword(
@RequestBody @Validated @NotNull UserModifyPasswordDTO userModifyPasswordDTO) { @RequestBody @Validated @NotNull UserModifyPasswordDTO userModifyPasswordDTO) {
// 判断密码 // 判断密码
if (userModifyPasswordDTO.getOldPassword().equals(userModifyPasswordDTO.getNewPassword())) { if (userModifyPasswordDTO.getOldPassword().equals(userModifyPasswordDTO.getNewPassword())) {
@ -142,8 +142,6 @@ public class CommonController {
user.setPassword(Md5Util.getMD5String(userModifyPasswordDTO.getNewPassword())); user.setPassword(Md5Util.getMD5String(userModifyPasswordDTO.getNewPassword()));
user.setUpdateTime(null); user.setUpdateTime(null);
userService.updateById(user); userService.updateById(user);
// 删除redis当中的token
stringRedisTemplate.delete(token);
// 删除当前线程的存储信息 // 删除当前线程的存储信息
ThreadLocalUtil.remove(); ThreadLocalUtil.remove();
return new Result<>(200, "密码修改成功, 请重新登陆", ""); return new Result<>(200, "密码修改成功, 请重新登陆", "");

Loading…
Cancel
Save