| | |
| | | return Result.succeed(null); |
| | | } |
| | | |
| | | @PostMapping("updateOldAndNewSafePsw") |
| | | @ApiOperation("修改资金密码 用旧资金密码") |
| | | public Result updateOldAndNewSafePsw(String old_password, String password, String re_password) { |
| | | |
| | | if (StringUtils.isEmptyString(old_password)) { |
| | | throw new YamiShopBindException("旧资金密码不能为空"); |
| | | } |
| | | if (StringUtils.isEmptyString(password)) { |
| | | throw new YamiShopBindException("新资金密码不能为空"); |
| | | } |
| | | if (StringUtils.isEmptyString(re_password)) { |
| | | throw new YamiShopBindException("新资金密码确认不能为空"); |
| | | } |
| | | if (old_password.length() < 6 || old_password.length() > 12 || password.length() < 6 || password.length() > 12) { |
| | | throw new YamiShopBindException("密码必须6-12位"); |
| | | } |
| | | User secUser = userService.getById(SecurityUtils.getUser().getUserId()); |
| | | if (!passwordEncoder.matches(old_password, secUser.getSafePassword())) { |
| | | throw new YamiShopBindException("旧密码不正确!"); |
| | | } |
| | | if (!password.equals(re_password)) { |
| | | throw new YamiShopBindException("新密码不一致"); |
| | | } |
| | | secUser.setSafePassword(passwordEncoder.encode(re_password)); |
| | | userService.updateById(secUser); |
| | | return Result.succeed(null); |
| | | } |
| | | |
| | | /** |
| | | * 修改资金密码 用验证码 |
| | | */ |