|
@@ -713,6 +713,21 @@ public class UserController {
|
|
|
public ResponseEntity saveInfo(@RequestBody UserDTO userDTO) {
|
|
|
userService.updateById ( UserWrapper.INSTANCE.toEntity ( userDTO ) );
|
|
|
UserUtils.deleteCache ( UserUtils.getCurrentUserDTO ( ) );
|
|
|
+
|
|
|
+ UserDTO newestUserDTO = UserUtils.getCurrentUserDTO ( );
|
|
|
+ if ( StrUtil.isNotBlank ( userDTO.getOldPassword() ) && StrUtil.isNotBlank ( userDTO.getNewPassword() ) ) {
|
|
|
+ if ( SecurityUtils.validatePassword ( userDTO.getOldPassword(), newestUserDTO.getPassword ( ) ) ) {
|
|
|
+ User user = new User ( newestUserDTO.getId ( ) );
|
|
|
+ user.setPassword ( SecurityUtils.encryptPassword ( userDTO.getNewPassword() ) );
|
|
|
+ user.setUpPassword("1");
|
|
|
+ userService.updateById ( user );
|
|
|
+ UserUtils.deleteCache ( userDTO );
|
|
|
+ return ResponseEntity.ok ( "修改密码成功!" );
|
|
|
+ } else {
|
|
|
+ return ResponseEntity.badRequest ( ).body ( "修改密码失败,旧密码错误!" );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return ResponseEntity.ok ( "修改个人资料成功!" );
|
|
|
}
|
|
|
|
|
@@ -1145,8 +1160,9 @@ public class UserController {
|
|
|
if (ObjectUtil.isNotEmpty( user )) {
|
|
|
//生成四位随机验证码
|
|
|
String randomCode = String.valueOf((int) (Math.random() * 9000 + 1000));
|
|
|
-
|
|
|
- HashMap<String,Object> result = null;
|
|
|
+ System.out.println(randomCode);
|
|
|
+ redisUtils.setEx(mobile+ "resetPassword", randomCode, 300, TimeUnit.SECONDS);
|
|
|
+ /*HashMap<String,Object> result = null;
|
|
|
try{
|
|
|
//调用工具类返回结果
|
|
|
result = UserUtils.sendRandomCodes(mobile, randomCode);
|
|
@@ -1169,7 +1185,7 @@ public class UserController {
|
|
|
e.printStackTrace();
|
|
|
j.put("success",false);
|
|
|
j.put("message","短信发送失败!");
|
|
|
- }
|
|
|
+ }*/
|
|
|
} else {
|
|
|
j.put("success",false);
|
|
|
j.put("message","当前手机号未注册!请联系管理员");
|