Skip to content

Commit

Permalink
v1.9 发布,详情查看发行版说明
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjie committed May 18, 2019
1 parent 343ce34 commit 4d9cbfe
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,32 @@ public ResponseEntity delete(@PathVariable Long id){

/**
* 验证密码
* @param pass
* @param user
* @return
*/
@GetMapping(value = "/users/validPass/{pass}")
public ResponseEntity validPass(@PathVariable String pass){
@PostMapping(value = "/users/validPass")
public ResponseEntity validPass(@RequestBody User user){
UserDetails userDetails = SecurityUtils.getUserDetails();
Map map = new HashMap();
map.put("status",200);
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
map.put("status",400);
}
return new ResponseEntity(map,HttpStatus.OK);
}

/**
* 修改密码
* @param pass
* @param user
* @return
*/
@GetMapping(value = "/users/updatePass/{pass}")
public ResponseEntity updatePass(@PathVariable String pass){
@PostMapping(value = "/users/updatePass")
public ResponseEntity updatePass(@RequestBody User user){
UserDetails userDetails = SecurityUtils.getUserDetails();
if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){
if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
throw new BadRequestException("新密码不能与旧密码相同");
}
userService.updatePass(userDetails.getUsername(),EncryptUtils.encryptPassword(pass));
userService.updatePass(userDetails.getUsername(),EncryptUtils.encryptPassword(user.getPassword()));
return new ResponseEntity(HttpStatus.OK);
}

Expand Down

0 comments on commit 4d9cbfe

Please sign in to comment.