fix(system): 校验邮箱验证码时增加业务类型检查

This commit is contained in:
2025-10-31 13:57:52 +08:00
parent d49d40fec1
commit 4021df78e8
2 changed files with 8 additions and 0 deletions
@@ -16,6 +16,7 @@
package cn.odboy.system.controller; package cn.odboy.system.controller;
import cn.odboy.framework.exception.BadRequestException;
import cn.odboy.system.constant.SystemCaptchaBizEnum; import cn.odboy.system.constant.SystemCaptchaBizEnum;
import cn.odboy.system.dal.model.SystemCheckEmailCaptchaArgs; import cn.odboy.system.dal.model.SystemCheckEmailCaptchaArgs;
import cn.odboy.system.service.SystemEmailService; import cn.odboy.system.service.SystemEmailService;
@@ -51,6 +52,9 @@ public class SystemCaptchaController {
@PostMapping(value = "/checkEmailCaptcha") @PostMapping(value = "/checkEmailCaptcha")
public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) { public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode());
if (biEnum == null) {
throw new BadRequestException("不支持的业务");
}
systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode()); systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode());
return ResponseEntity.ok(null); return ResponseEntity.ok(null);
} }
@@ -16,6 +16,7 @@
package cn.odboy.system.controller; package cn.odboy.system.controller;
import cn.odboy.framework.exception.BadRequestException;
import cn.odboy.system.constant.SystemCaptchaBizEnum; import cn.odboy.system.constant.SystemCaptchaBizEnum;
import cn.odboy.system.dal.model.SystemCheckEmailCaptchaArgs; import cn.odboy.system.dal.model.SystemCheckEmailCaptchaArgs;
import cn.odboy.system.service.SystemEmailService; import cn.odboy.system.service.SystemEmailService;
@@ -52,6 +53,9 @@ public class SystemCaptchaController {
@PostMapping(value = "/checkEmailCaptcha") @PostMapping(value = "/checkEmailCaptcha")
public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) { public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode());
if (biEnum == null) {
throw new BadRequestException("不支持的业务");
}
systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode()); systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode());
return ResponseEntity.ok(null); return ResponseEntity.ok(null);
} }