|
@@ -219,10 +219,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
sysUser.setPassword(newPwd);
|
|
sysUser.setPassword(newPwd);
|
|
}
|
|
}
|
|
if (SystemConstant.strNotNull(mobileNumber)) {
|
|
if (SystemConstant.strNotNull(mobileNumber)) {
|
|
- // 参数中存在手机号 -》 更新手机号
|
|
|
|
- if (!SystemConstant.strNotNull(verifyCode)) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("验证码不存在");
|
|
|
|
- }
|
|
|
|
|
|
+ // 校验验证码
|
|
this.checkSmsCode(user.getId(), mobileNumber, verifyCode);
|
|
this.checkSmsCode(user.getId(), mobileNumber, verifyCode);
|
|
// 更新电话
|
|
// 更新电话
|
|
|
|
|
|
@@ -839,22 +836,22 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
SysConfig value = sysConfigService.getByKey("sys.code.enable");
|
|
SysConfig value = sysConfigService.getByKey("sys.code.enable");
|
|
if (Objects.nonNull(value) && value.getConfigValue().equals("true")) {
|
|
if (Objects.nonNull(value) && value.getConfigValue().equals("true")) {
|
|
if (Objects.isNull(code)) {
|
|
if (Objects.isNull(code)) {
|
|
- throw ExceptionResultEnum.ERROR.exception("验证码为空");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("验证码不能为空");
|
|
}
|
|
}
|
|
SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SMS_NORMAL_CODE);
|
|
SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SMS_NORMAL_CODE);
|
|
Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置万能短信验证码"));
|
|
Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置万能短信验证码"));
|
|
if (!sysConfig.getConfigValue().equals(code)) {
|
|
if (!sysConfig.getConfigValue().equals(code)) {
|
|
List<VerifyCodeCheckDto> verifyCodeCheckDtoList = this.baseMapper.findVerifyCodeByUser(userId, mobileNumber);
|
|
List<VerifyCodeCheckDto> verifyCodeCheckDtoList = this.baseMapper.findVerifyCodeByUser(userId, mobileNumber);
|
|
if (verifyCodeCheckDtoList.size() < 1) {
|
|
if (verifyCodeCheckDtoList.size() < 1) {
|
|
- throw ExceptionResultEnum.ERROR.exception("请确认已经发送了验证码");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("验证码错误");
|
|
}
|
|
}
|
|
VerifyCodeCheckDto accessControl = verifyCodeCheckDtoList.get(0);
|
|
VerifyCodeCheckDto accessControl = verifyCodeCheckDtoList.get(0);
|
|
if (accessControl == null || !accessControl.getVerifyCode().equals(code)) {
|
|
if (accessControl == null || !accessControl.getVerifyCode().equals(code)) {
|
|
- throw ExceptionResultEnum.ERROR.exception("短信验证码错误,请仔细核对后再次输入");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("验证码错误");
|
|
}
|
|
}
|
|
|
|
|
|
if (new Date(accessControl.getExpireTime()).before(new Date())) {
|
|
if (new Date(accessControl.getExpireTime()).before(new Date())) {
|
|
- throw ExceptionResultEnum.ERROR.exception("短信验证码已过期");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("验证码已过期");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|