Commit 4d9cbfe0 authored by zhengjie's avatar zhengjie
Browse files

v1.9 发布,详情查看发行版说明

parent 343ce346
...@@ -131,15 +131,15 @@ public class UserController { ...@@ -131,15 +131,15 @@ public class UserController {
/** /**
* 验证密码 * 验证密码
* @param pass * @param user
* @return * @return
*/ */
@GetMapping(value = "/users/validPass/{pass}") @PostMapping(value = "/users/validPass")
public ResponseEntity validPass(@PathVariable String pass){ public ResponseEntity validPass(@RequestBody User user){
UserDetails userDetails = SecurityUtils.getUserDetails(); UserDetails userDetails = SecurityUtils.getUserDetails();
Map map = new HashMap(); Map map = new HashMap();
map.put("status",200); map.put("status",200);
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){ if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
map.put("status",400); map.put("status",400);
} }
return new ResponseEntity(map,HttpStatus.OK); return new ResponseEntity(map,HttpStatus.OK);
...@@ -147,16 +147,16 @@ public class UserController { ...@@ -147,16 +147,16 @@ public class UserController {
/** /**
* 修改密码 * 修改密码
* @param pass * @param user
* @return * @return
*/ */
@GetMapping(value = "/users/updatePass/{pass}") @PostMapping(value = "/users/updatePass")
public ResponseEntity updatePass(@PathVariable String pass){ public ResponseEntity updatePass(@RequestBody User user){
UserDetails userDetails = SecurityUtils.getUserDetails(); UserDetails userDetails = SecurityUtils.getUserDetails();
if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){ if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
throw new BadRequestException("新密码不能与旧密码相同"); throw new BadRequestException("新密码不能与旧密码相同");
} }
userService.updatePass(userDetails.getUsername(),EncryptUtils.encryptPassword(pass)); userService.updatePass(userDetails.getUsername(),EncryptUtils.encryptPassword(user.getPassword()));
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment