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

pull/62/head^2
zhengjie 2019-05-18 17:53:27 +08:00
parent 343ce346db
commit 4d9cbfe08b
1 changed files with 9 additions and 9 deletions

View File

@ -131,15 +131,15 @@ public class UserController {
/**
*
* @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);
@ -147,16 +147,16 @@ public class UserController {
/**
*
* @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);
}