|
@@ -92,10 +92,9 @@ public class UserController extends BaseController {
|
|
|
@PostMapping(value = "/updatePassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "newPassword", value = "新密码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "password", value = "旧密码", required = true, dataType = "String") })
|
|
|
+ @ApiImplicitParam(name = "newPassword", value = "新密码", required = true, dataType = "String")})
|
|
|
public Object updatePassword(String mobile,String authCode,String password,String newPassword) {
|
|
|
- if(StringUtils.isEmpty(mobile) || StringUtils.isEmpty(authCode) || StringUtils.isEmpty(password) || StringUtils.isEmpty(newPassword)){
|
|
|
+ if(StringUtils.isEmpty(mobile) || StringUtils.isEmpty(authCode) || StringUtils.isEmpty(newPassword)){
|
|
|
return failed("参数校验异常");
|
|
|
}
|
|
|
SysUser sysUser = sysUserService.queryByPhone(mobile);
|
|
@@ -103,28 +102,13 @@ public class UserController extends BaseController {
|
|
|
return failed("用户不存在");
|
|
|
}
|
|
|
if(smsCodeService.verifyValidCode(mobile, authCode)){
|
|
|
- if(StringUtils.equals(password,newPassword)){
|
|
|
- return failed("新密码与旧密码一致");
|
|
|
- }
|
|
|
- BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
|
|
- newPassword = bCryptPasswordEncoder.encode(newPassword);
|
|
|
- if(bCryptPasswordEncoder.matches(password,sysUser.getPassword())){
|
|
|
- sysUserService.updatePassword(mobile,newPassword);
|
|
|
- return succeed();
|
|
|
- }else {
|
|
|
- return failed("密码错误");
|
|
|
- }
|
|
|
+ sysUserService.updatePassword(mobile,newPassword);
|
|
|
+ return succeed();
|
|
|
}else {
|
|
|
return failed("验证码错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*@ApiOperation(value = "删除用户")
|
|
|
- @DeleteMapping("/del/{id}")
|
|
|
- public Object del(@ApiParam(value = "用户编号", required = true) @PathVariable("id") Integer id) {
|
|
|
- return sysUserService.deleteById(id) ? succeed("删除成功") : failed("删除失败");
|
|
|
- }*/
|
|
|
-
|
|
|
@ApiOperation(value = "修改用户")
|
|
|
@PostMapping(value = "/update",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object update(SysUser sysUser) {
|